File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : PHPCS check
2+
3+ on : pull_request
4+
5+ permissions :
6+ actions : read
7+ checks : read
8+ contents : read
9+ deployments : none
10+ issues : read
11+ packages : none
12+ pull-requests : read
13+ repository-projects : none
14+ security-events : none
15+ statuses : read
16+
17+ jobs :
18+ phpcs :
19+ name : PHPCS
20+ runs-on : ubuntu-latest
21+ steps :
22+ - uses : actions/checkout@v4
23+ with :
24+ lfs : false
25+ persist-credentials : false
26+ - name : Setup PHP
27+ uses : shivammathur/setup-php@v2
28+ with :
29+ php-version : ' 7.4'
30+ tools : cs2pr
31+ - name : Install dependencies
32+ run :
33+ composer init --name=matomo/devicedetectorcache --quiet;
34+ composer --no-plugins config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true -n;
35+ composer config repositories.matomo-coding-standards vcs https://github.com/matomo-org/matomo-coding-standards -n;
36+ composer require matomo-org/matomo-coding-standards:dev-master;
37+ composer install --dev --prefer-dist --no-progress --no-suggest
38+ - name : Check PHP code styles
39+ id : phpcs
40+ run : ./vendor/bin/phpcs --report-full --standard=phpcs.xml --report-checkstyle=./phpcs-report.xml
41+ - name : Show PHPCS results in PR
42+ if : ${{ always() && steps.phpcs.outcome == 'failure' }}
43+ run : cs2pr ./phpcs-report.xml --prepend-filename
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" ?>
2+ <ruleset name =" deviceDetectorCache" xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : noNamespaceSchemaLocation =" vendor/squizlabs/php_codesniffer/phpcs.xsd" >
3+
4+ <description >Matomo Coding Standard for DeviceDetectorCache plugin</description >
5+
6+ <arg name =" extensions" value =" php" />
7+
8+ <file >.</file >
9+
10+ <exclude-pattern >tests/javascript/*</exclude-pattern >
11+ <exclude-pattern >*/vendor/*</exclude-pattern >
12+
13+ <rule ref =" Matomo" ></rule >
14+
15+ <rule ref =" Generic.Files.LineLength" >
16+ <properties >
17+ <property name =" lineLimit" value =" 250" />
18+ </properties >
19+ <exclude-pattern >tests/*</exclude-pattern >
20+ </rule >
21+
22+ <rule ref =" Squiz.Classes.ValidClassName.NotCamelCaps" >
23+ <!-- Classnames for our update files don't match PascalCase, this can't be changed easily -->
24+ <exclude-pattern >Updates/*</exclude-pattern >
25+ </rule >
26+
27+ <rule ref =" PSR1.Methods.CamelCapsMethodName.NotCamelCaps" >
28+ <!-- Allow using method name without camel caps in tests as long as some methods are named test_* -->
29+ <exclude-pattern >tests/*</exclude-pattern >
30+ </rule >
31+
32+ <rule ref =" PSR1.Classes.ClassDeclaration.MultipleClasses" >
33+ <!-- Allow using multiple classes in one file for tests -->
34+ <exclude-pattern >tests/*</exclude-pattern >
35+ </rule >
36+ </ruleset >
You can’t perform that action at this time.
0 commit comments