Skip to content

Commit 9c9cc5f

Browse files
committed
Initial commit
0 parents  commit 9c9cc5f

File tree

13 files changed

+666
-0
lines changed

13 files changed

+666
-0
lines changed

.github/dependabot.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Dependabot configuration.
2+
#
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "github-actions"
9+
directory: "/"
10+
schedule:
11+
interval: "weekly"
12+
open-pull-requests-limit: 5
13+
target-branch: "stable"
14+
commit-message:
15+
prefix: "GH Actions:"
16+
labels:
17+
- "Type: chores/QA"
18+
19+
- package-ecosystem: "composer"
20+
directory: "/"
21+
schedule:
22+
interval: "weekly"
23+
open-pull-requests-limit: 5 # Set to 0 to (temporarily) disable.
24+
commit-message:
25+
prefix: "Composer:"
26+
include: "scope"
27+
labels:
28+
- "Type: chores/QA"

.github/workflows/qa.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: QA
2+
3+
on:
4+
# Run on all pushes and on all pull requests.
5+
push:
6+
pull_request:
7+
# Allow manually triggering the workflow.
8+
workflow_dispatch:
9+
10+
# Cancels all previous workflow runs for the same branch that have not yet completed.
11+
concurrency:
12+
# The concurrency group contains the workflow name and the branch name.
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
checkcs:
18+
name: 'Basic CS and QA checks'
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
25+
- name: Install PHP
26+
uses: shivammathur/setup-php@v2
27+
with:
28+
php-version: 'latest'
29+
coverage: none
30+
tools: cs2pr
31+
32+
# Validate the composer.json file.
33+
# @link https://getcomposer.org/doc/03-cli.md#validate
34+
- name: Validate Composer installation
35+
run: composer validate --no-check-all --strict
36+
37+
# Install dependencies and handle caching in one go.
38+
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
39+
- name: Install Composer dependencies
40+
uses: "ramsey/composer-install@v3"
41+
with:
42+
# Bust the cache at least once a month - output format: YYYY-MM.
43+
custom-cache-suffix: $(date -u "+%Y-%m")
44+
45+
- name: Validate Project PHPCS ruleset against schema
46+
uses: phpcsstandards/xmllint-validate@v1
47+
with:
48+
pattern: "phpcs.xml.dist"
49+
xsd-file: "vendor/squizlabs/php_codesniffer/phpcs.xsd"
50+
51+
# Check the code-style consistency of the PHP files.
52+
- name: Check PHP code style
53+
id: phpcs
54+
run: composer checkcs -- --report-full --report-checkstyle=./phpcs-report.xml
55+
56+
- name: Show PHPCS results in PR
57+
if: ${{ always() && steps.phpcs.outcome == 'failure' }}
58+
run: cs2pr ./phpcs-report.xml
59+
60+
phpstan:
61+
uses: PHPCSStandards/.github/.github/workflows/reusable-phpstan.yml@main
62+
63+
yamllint:
64+
name: 'Lint Yaml'
65+
uses: PHPCSStandards/.github/.github/workflows/reusable-yamllint.yml@main
66+
with:
67+
strict: true
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: Deploy static content to GH Pages
2+
3+
on:
4+
# Runs on pushes targeting the default branch
5+
push:
6+
branches:
7+
- 'stable'
8+
# Do a dry-run (update, no deploy) for PRs.
9+
pull_request:
10+
# Allow running this workflow manually from the Actions tab.
11+
workflow_dispatch:
12+
# Allow this workflow to be triggered from outside.
13+
repository_dispatch:
14+
types:
15+
- 'phpcs-release'
16+
17+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
18+
permissions:
19+
contents: write
20+
pages: write
21+
id-token: write
22+
23+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
24+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
25+
concurrency:
26+
group: "pages"
27+
cancel-in-progress: false
28+
29+
jobs:
30+
update:
31+
name: "Update XSD files"
32+
33+
# Don't run on forks.
34+
if: github.repository == 'PHPCSStandards/schema.phpcodesniffer.com'
35+
36+
runs-on: ubuntu-latest
37+
steps:
38+
# By default use the `stable` branch.
39+
# For testing changes to the workflow or the scripts, use the PR branch
40+
# to have access to the latest version of the workflow/scripts.
41+
- name: Determine branch to use
42+
id: base_branch
43+
env:
44+
REF: ${{ github.ref }}
45+
run: |
46+
if [ "${{ github.event_name }}" == "pull_request" ]; then
47+
echo "BRANCH=$REF" >> "$GITHUB_OUTPUT"
48+
else
49+
echo 'BRANCH=stable' >> "$GITHUB_OUTPUT"
50+
fi
51+
52+
- name: Checkout code
53+
uses: actions/checkout@v4
54+
with:
55+
ref: ${{ steps.base_branch.outputs.BRANCH }}
56+
57+
- name: Install PHP
58+
uses: shivammathur/setup-php@v2
59+
with:
60+
php-version: '8.4'
61+
ini-values: error_reporting=-1, display_errors=On, log_errors_max_len=0
62+
coverage: none
63+
64+
- name: Get a list of the last 50 PHP_CodeSniffer releases
65+
env:
66+
GH_TOKEN: ${{ github.token }}
67+
run: >
68+
gh release list --repo PHPCSStandards/PHP_CodeSniffer --limit=50 --order desc
69+
--json tagName,isPrerelease,isLatest,isDraft > releases.json
70+
71+
- name: Update XSD files
72+
run: php ./src/update-site.php
73+
74+
- name: Delete releases.json
75+
run: rm releases.json
76+
77+
- name: "Debug info: check git status"
78+
run: git status -b -v -u
79+
80+
# Commit all changed files back to the repository
81+
- name: Commit updated files
82+
uses: stefanzweifel/git-auto-commit-action@v5
83+
with:
84+
commit_message: "Update XSD files"
85+
add_options: '-A'
86+
87+
- name: Check GitHub Pages status
88+
uses: crazy-max/ghaction-github-status@v4
89+
with:
90+
pages_threshold: major_outage
91+
92+
- name: Setup Pages
93+
uses: actions/configure-pages@v5
94+
95+
- name: Upload static files as artifact
96+
uses: actions/upload-pages-artifact@v3
97+
with:
98+
# Upload _site directory only.
99+
path: _site/
100+
101+
deploy:
102+
needs: update
103+
# Don't run on forks.
104+
if: github.repository == 'PHPCSStandards/schema.phpcodesniffer.com' && github.event_name != 'pull_request' && needs.update.result == 'success'
105+
106+
name: "Deploy the website"
107+
runs-on: ubuntu-latest
108+
109+
environment:
110+
name: github-pages
111+
url: ${{ steps.deployment.outputs.page_url }}
112+
113+
steps:
114+
- name: Deploy to GitHub Pages
115+
id: deployment
116+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
vendor/
2+
composer.lock
3+
.phpcs.xml
4+
phpcs.xml
5+
phpstan.neon
6+
releases.json

.yamllint.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Details on the default config:
2+
# https://yamllint.readthedocs.io/en/stable/configuration.html#default-configuration
3+
extends: default
4+
5+
yaml-files:
6+
- '*.yaml'
7+
- '*.yml'
8+
- '.yamllint'
9+
- 'phpstan.neon*'
10+
11+
# Rule documentation: https://yamllint.readthedocs.io/en/stable/rules.html
12+
rules:
13+
colons:
14+
max-spaces-after: -1 # Disabled to allow aligning of values.
15+
comments:
16+
min-spaces-from-content: 1
17+
comments-indentation: {}
18+
document-start:
19+
present: false
20+
line-length:
21+
max: 150
22+
truthy:
23+
allowed-values: ["true", "false", "on", "off"]

CNAME

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
schema.phpcodesniffer.com

LICENSE

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2025, PHPCSStandards
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are met:
7+
8+
1. Redistributions of source code must retain the above copyright notice, this
9+
list of conditions and the following disclaimer.
10+
11+
2. Redistributions in binary form must reproduce the above copyright notice,
12+
this list of conditions and the following disclaimer in the documentation
13+
and/or other materials provided with the distribution.
14+
15+
3. Neither the name of the copyright holder nor the names of its
16+
contributors may be used to endorse or promote products derived from
17+
this software without specific prior written permission.
18+
19+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# schema.phpcodesniffer.com
2+
3+
This repository is set up to automatically update the <https://schema.phpcodesniffer.com/> "website".
4+
5+
<https://schema.phpcodesniffer.com/> provides permalinks to the PHP_CodeSniffer ruleset XSD file.
6+
7+
* The latest version of the XSD file will always be available at: <https://schema.phpcodesniffer.com/phpcs.xsd>
8+
* The XSD file for each PHP_CodeSniffer minor since PHPCS 3.2.0 can be found at the following permalink(s):
9+
```text
10+
// Replace "#.#" with the minor you are targetting.
11+
https://schema.phpcodesniffer.com/#.#/phpcs.xsd
12+
13+
// Example for the XSD file for PHP_CodeSniffer 3.13.x:
14+
https://schema.phpcodesniffer.com/3.13/phpcs.xsd
15+
```

composer.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"name" : "phpcsstandards/schema.phpcodesniffer.com",
3+
"description" : "Schema website for PHP_CodeSniffer",
4+
"homepage": "https://schema.phpcodesniffer.com/",
5+
"license": "BSD-3-Clause",
6+
"type": "project",
7+
"authors" : [
8+
{
9+
"name" : "Juliette Reinders Folmer",
10+
"role" : "lead",
11+
"homepage" : "https://github.com/jrfnl"
12+
},
13+
{
14+
"name" : "Contributors",
15+
"homepage" : "https://github.com/PHPCSStandards/schema.phpcodesniffer.com/graphs/contributors"
16+
}
17+
],
18+
"support" : {
19+
"source" : "https://github.com/PHPCSStandards/schema.phpcodesniffer.com",
20+
"security": "https://github.com/PHPCSStandards/schema.phpcodesniffer.com/security/policy"
21+
},
22+
"require-dev" : {
23+
"php" : "~8.4",
24+
"phpcsstandards/phpcsdevcs": "^1.1.6",
25+
"phpstan/phpstan": "^2.0.0"
26+
},
27+
"config": {
28+
"allow-plugins": {
29+
"dealerdirect/phpcodesniffer-composer-installer": true
30+
},
31+
"lock": false
32+
},
33+
"minimum-stability": "dev",
34+
"prefer-stable": true,
35+
"scripts" : {
36+
"checkcs": [
37+
"@php ./vendor/squizlabs/php_codesniffer/bin/phpcs"
38+
],
39+
"fixcs": [
40+
"@php ./vendor/squizlabs/php_codesniffer/bin/phpcbf"
41+
]
42+
}
43+
}

phpcs.xml.dist

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?xml version="1.0"?>
2+
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="schema.phpcodesniffer.com" xsi:noNamespaceSchemaLocation="./vendor/squizlabs/php_codesniffer/phpcs.xsd">
3+
4+
<!--
5+
#############################################################################
6+
COMMAND LINE ARGUMENTS
7+
https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Annotated-ruleset.xml
8+
#############################################################################
9+
-->
10+
11+
<file>./src/</file>
12+
13+
<!-- Only check PHP files. -->
14+
<arg name="extensions" value="php"/>
15+
16+
<!-- Show progress, show the error codes for each message (source). -->
17+
<arg value="ps"/>
18+
19+
<!-- Strip the filepaths down to the relevant bit. -->
20+
<arg name="basepath" value="./"/>
21+
22+
<!-- Check up to 8 files simultaneously. -->
23+
<arg name="parallel" value="8"/>
24+
25+
<!--
26+
#############################################################################
27+
USE THE PHPCSDev RULESET
28+
#############################################################################
29+
-->
30+
31+
<rule ref="PHPCSDev">
32+
<!-- Allow for the file docblock on the line directly following the PHP open tag.
33+
As the sniff in PHPCS does not use modular error codes (yet - see PR #2729),
34+
the complete error code needs to be disabled, not just the bit involving
35+
the file docblocks.
36+
-->
37+
<exclude name="PSR12.Files.FileHeader.SpacingAfterBlock"/>
38+
<exclude name="PEAR.Commenting.FileComment.MissingPackageTag"/>
39+
</rule>
40+
41+
<!-- Set minimum PHP version supported to PHP 8.4. -->
42+
<config name="testVersion" value="8.4-"/>
43+
44+
</ruleset>

0 commit comments

Comments
 (0)