Skip to content

Commit 574f43a

Browse files
authored
Merge pull request #109 from PHPCSStandards/feature/various-minor-touchups
GH Actions/XSD: various minor touchups
2 parents d6641f6 + d0a353c commit 574f43a

File tree

3 files changed

+22
-16
lines changed

3 files changed

+22
-16
lines changed

.github/workflows/cs.yml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,34 +50,36 @@ jobs:
5050
- name: Install Composer dependencies
5151
uses: "ramsey/composer-install@v2"
5252

53+
# @link http://xmlsoft.org/xmllint.html
5354
- name: Install xmllint
5455
run: |
5556
sudo apt-get update
5657
sudo apt-get install --no-install-recommends -y libxml2-utils
5758
59+
- name: Download the XSD schema
60+
run: curl http://www.w3.org/2001/XMLSchema.xsd --output XMLSchema.xsd
61+
5862
# Show XML violations inline in the file diff.
5963
# @link https://github.com/marketplace/actions/xmllint-problem-matcher
6064
- uses: korelstar/xmllint-problem-matcher@v1
6165

62-
# Validate the Docs XSD file.
63-
# @link http://xmlsoft.org/xmllint.html
66+
# Validate the XSD and XML files against schema.
6467
- name: Validate Docs XSD against schema
65-
run: xmllint --noout --schema http://www.w3.org/2001/XMLSchema.xsd DocsXsd/phpcsdocs.xsd
68+
run: xmllint --noout --schema XMLSchema.xsd DocsXsd/phpcsdocs.xsd
6669

67-
# Validate the XML file.
68-
# @link http://xmlsoft.org/xmllint.html
69-
- name: Validate ruleset against schema
70+
- name: Validate PHPCSDebug ruleset against schema
7071
run: xmllint --noout --schema vendor/squizlabs/php_codesniffer/phpcs.xsd PHPCSDebug/ruleset.xml
7172

72-
# Check the code-style consistency of the XML file.
73-
- name: Check XML code style
74-
run: diff -B ./PHPCSDebug/ruleset.xml <(xmllint --format "./PHPCSDebug/ruleset.xml")
75-
76-
# Validate the Docs XML file(s).
77-
# @link http://xmlsoft.org/xmllint.html
7873
- name: Validate docs against schema
7974
run: xmllint --noout --schema DocsXsd/phpcsdocs.xsd ./PHPCSDebug/Docs/*/*Standard.xml
8075

76+
# Check code-style consistency of the XSD and XML files.
77+
- name: Check XSD code style
78+
run: diff -B ./DocsXsd/phpcsdocs.xsd <(xmllint --format "./DocsXsd/phpcsdocs.xsd")
79+
80+
- name: Check Ruleset XML code style
81+
run: diff -B ./PHPCSDebug/ruleset.xml <(xmllint --format "./PHPCSDebug/ruleset.xml")
82+
8183
# Check the code-style consistency of the PHP files.
8284
- name: Check PHP code style
8385
continue-on-error: true

PHPCSDebug/Docs/Debug/TokenListStandard.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" title="Token List">
1+
<?xml version="1.0"?>
2+
<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd"
4+
title="Token List"
5+
>
26
<standard>
37
<![CDATA[
48
Lists how PHPCS tokenizes code.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,17 +199,17 @@ In order to use it, you'll need to add the schema related attributes to the `doc
199199

200200
```xml
201201
<documentation
202-
title="Name of the sniff"
203202
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
204203
xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd"
204+
title="Name of the sniff"
205205
>
206206
```
207207

208208
If your IDE or editor supports automatic validation of XML files, you will be notified if your documentation XML file has the correct number of elements, correct type and number of certain attributes, and title length among other things.
209209

210210
#### Validating your docs against the XSD
211211

212-
You can validate your PHPCS XML documentation against the XSD file using [xmllint](https://gnome.pages.gitlab.gnome.org/libxml2/xmllint.html). This validation can be run locally if you have xmllint installed, as well as in CI (continuous integration).
212+
You can validate your PHPCS XML documentation against the XSD file using [xmllint](http://xmlsoft.org/xmllint.html). This validation can be run locally if you have xmllint installed, as well as in CI (continuous integration).
213213

214214
An example of a workflow job for GitHub Actions CI looks like this:
215215

@@ -232,7 +232,7 @@ jobs:
232232
run: xmllint --noout --schema vendor/phpcsstandards/phpcsdevtools/DocsXsd/phpcsdocs.xsd ./YourRuleset/Docs/**/*Standard.xml
233233
```
234234
235-
You'd need to replace the `YourRuleset` with the name of your ruleset of course.
235+
:point_right: You'll need to replace the `YourRuleset` within the command with the name of your ruleset (of course).
236236

237237
Contributing
238238
-------

0 commit comments

Comments
 (0)