Skip to content

Commit 7be2466

Browse files
authored
Merge pull request #29 from jrfnl/feature/ghactions-add-qa-for-ruleset
GH Actions: add a QA workflow for a typical PHPCS workflow
2 parents a6ecfcc + e8f3422 commit 7be2466

File tree

2 files changed

+58
-11
lines changed

2 files changed

+58
-11
lines changed

.github/workflows/qa.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
on:
2+
push:
3+
branches:
4+
- latest
5+
pull_request:
6+
# Allow manually triggering the workflow.
7+
workflow_dispatch:
8+
9+
name: qa
10+
jobs:
11+
xmllint:
12+
name: 'Check install and XML'
13+
runs-on: ubuntu-latest
14+
15+
env:
16+
XMLLINT_INDENT: ' '
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v2
21+
22+
- name: Install PHP
23+
uses: shivammathur/setup-php@v2
24+
with:
25+
php-version: '7.4'
26+
coverage: none
27+
28+
# Validate the composer.json file.
29+
# @link https://getcomposer.org/doc/03-cli.md#validate
30+
- name: Validate Composer installation
31+
run: composer validate --no-check-all --strict
32+
33+
# Install dependencies to make sure the PHPCS XSD file is available.
34+
- name: Install dependencies
35+
run: composer install --prefer-dist --no-interaction --no-progress
36+
37+
- name: Setup xmllint
38+
run: sudo apt-get install --no-install-recommends -y libxml2-utils
39+
40+
# Show violations inline in the file diff.
41+
# @link https://github.com/marketplace/actions/xmllint-problem-matcher
42+
- uses: korelstar/xmllint-problem-matcher@v1
43+
44+
# Validate the xml file.
45+
# @link http://xmlsoft.org/xmllint.html
46+
- name: Validate against schema
47+
run: xmllint --noout --schema vendor/squizlabs/php_codesniffer/phpcs.xsd lib/phpDocumentor/ruleset.xml
48+
49+
# Check the code-style consistency of the xml file.
50+
- name: Check code style
51+
run: diff -B ./lib/phpDocumentor/ruleset.xml <(xmllint --format "./lib/phpDocumentor/ruleset.xml")

lib/phpDocumentor/ruleset.xml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
11
<?xml version="1.0"?>
2-
<ruleset
3-
name="phpDocumentor"
4-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5-
xsi:noNamespaceSchemaLocation="../../vendor/squizlabs/php_codesniffer/phpcs.xsd"
6-
>
2+
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="phpDocumentor" xsi:noNamespaceSchemaLocation="../../vendor/squizlabs/php_codesniffer/phpcs.xsd">
73
<description>The phpDocumentor coding standard.</description>
84

95
<!-- Import Doctrine coding standard (base) -->
106
<rule ref="Doctrine">
11-
<exclude name="Generic.Formatting.MultipleStatementAlignment.NotSame" />
12-
<exclude name="SlevomatCodingStandard.Classes.SuperfluousExceptionNaming.SuperfluousSuffix" />
13-
<exclude name="SlevomatCodingStandard.TypeHints.UselessConstantTypeHint.UselessDocComment" />
7+
<exclude name="Generic.Formatting.MultipleStatementAlignment.NotSame"/>
8+
<exclude name="SlevomatCodingStandard.Classes.SuperfluousExceptionNaming.SuperfluousSuffix"/>
9+
<exclude name="SlevomatCodingStandard.TypeHints.UselessConstantTypeHint.UselessDocComment"/>
1410

1511
<!-- Disable param alignment in docblocks -->
16-
<exclude name="Squiz.Commenting.FunctionComment.SpacingAfterParamType" />
17-
<exclude name="Squiz.Commenting.FunctionComment.SpacingAfterParamName" />
12+
<exclude name="Squiz.Commenting.FunctionComment.SpacingAfterParamType"/>
13+
<exclude name="Squiz.Commenting.FunctionComment.SpacingAfterParamName"/>
1814
</rule>
1915

2016
<rule ref="Generic.Formatting.SpaceAfterNot">
2117
<properties>
22-
<property name="spacing" value="0" />
18+
<property name="spacing" value="0"/>
2319
</properties>
2420
</rule>
2521

0 commit comments

Comments
 (0)