-
Notifications
You must be signed in to change notification settings - Fork 37
70 lines (55 loc) · 2.48 KB
/
sniff.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: CS
on:
# Run on PRs and pushes.
push:
pull_request:
# Allow manually triggering the workflow.
workflow_dispatch:
env:
XMLLINT_INDENT: ' '
jobs:
qa_checks:
name: Quality control checks
runs-on: ubuntu-latest
steps:
# Checkout repository
- name: Checkout
uses: actions/checkout@v2
# Setup PHP versions, run checks
- name: PHP setup
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: none
tools: cs2pr
# Using PHPCS `master` as an early detection system for bugs upstream.
# As WPCS 3.0 is in development, not using WPCS `dev-develop`, though once WPCS 3.0 is in RC
# and this repo has been updated for compatibility, using `dev-develop` is probably a good
# idea to reenable as early warning system.
- name: Set the required PHPCS and WPCS versions
run: composer require squizlabs/php_codesniffer:"dev-master" wp-coding-standards/wpcs:"dev-master" --no-update --no-scripts
# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-composer-dependencies
- name: Install Composer dependencies
uses: ramsey/composer-install@v1
- name: Install xmllint
run: sudo apt-get install --no-install-recommends -y libxml2-utils
# Show XML violations inline in the file diff.
# @link https://github.com/marketplace/actions/xmllint-problem-matcher
- uses: korelstar/xmllint-problem-matcher@v1
- name: Validate ruleset against schema
run: xmllint --noout --schema ./vendor/squizlabs/php_codesniffer/phpcs.xsd ./*/ruleset.xml
- name: Check the code-style consistency of the xml files.
run: diff -B --tabsize=4 ./WPThemeReview/ruleset.xml <(xmllint --format "./WPThemeReview/ruleset.xml")
- name: Validate the composer.json file.
run: composer validate --no-check-all --strict
- name: Check the code style of the WPThemeReview codebase
continue-on-error: true
run: composer check-cs -- --report-full --report-checkstyle=./phpcs-report.xml
- name: Show PHPCS results in PR
run: cs2pr ./phpcs-report.xml
# Check that the sniffs available are feature complete.
# For now, just check that all sniffs have unit tests.
# At a later stage the documentation check can be activated.
- name: Check feature completeness of the available sniffs
run: composer check-complete