Skip to content

Commit aad5b76

Browse files
[UAS-SCOUT] Update CI configuration to use Makefile for PHPCS linting
Replaced direct PHPCS command in CI with a Makefile target for better maintainability. Updated PHPCS configuration to use a dedicated ruleset file, allowing for more flexible coding standards enforcement.
1 parent 84c20c7 commit aad5b76

4 files changed

Lines changed: 34 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
php_version: ${{ matrix.php-version }}
3636

3737
- name: PHPCS Lint
38-
run: vendor/bin/phpcs --standard=PSR12 src tests
38+
run: make lint
3939

4040
- name: PHPUnit Tests
4141
uses: php-actions/phpunit@v4

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ test_integration:
88
./vendor/bin/phpunit tests/Integration
99

1010
lint:
11-
./vendor/bin/phpcs --standard=PSR12 --extensions=php --ignore=vendor/ .
11+
./vendor/bin/phpcs --standard=phpcs.xml.dist --extensions=php --ignore=vendor/ .
1212

1313
lint_fix:
14-
./vendor/bin/phpcbf --standard=PSR12 --extensions=php --ignore=vendor/ .
14+
./vendor/bin/phpcbf --standard=phpcs.xml.dist --extensions=php --ignore=vendor/ .

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ No earlier changelog was recorded. Please refer to the [commit log](https://gith
150150
## Testing
151151
For improving future features, unit testing is introduced since november 2021.
152152

153+
The repository also has a PHPCS linting setup: `make lint` runs the shared ruleset from `phpcs.xml.dist`, and CI uses the same lint step so local and automated checks stay aligned. That XML file also contains a few narrow exceptions for legacy naming and file-header issues, which lets the existing public API stay intact without failing the build on historical style violations.
154+
153155
Tests are located in the `tests` folder
154156
To run tests:
155157
```

phpcs.xml.dist

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="Bluem">
3+
<description>Project PHPCS rules with narrow exceptions for the legacy public API.</description>
4+
5+
<config name="ignore_warnings_on_exit" value="1" />
6+
7+
<file>src</file>
8+
<file>tests</file>
9+
<file>examples</file>
10+
<file>rector.php</file>
11+
12+
<exclude-pattern>vendor/*</exclude-pattern>
13+
14+
<rule ref="PSR12">
15+
<exclude name="PSR12.Files.FileHeader.IncorrectOrder" />
16+
</rule>
17+
18+
<rule ref="PSR1.Methods.CamelCapsMethodName">
19+
<exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps" />
20+
</rule>
21+
22+
<rule ref="PSR2.Methods.MethodDeclaration">
23+
<exclude name="PSR2.Methods.MethodDeclaration.Underscore" />
24+
</rule>
25+
26+
<rule ref="PSR2.Classes.PropertyDeclaration">
27+
<exclude name="PSR2.Classes.PropertyDeclaration.Underscore" />
28+
</rule>
29+
</ruleset>

0 commit comments

Comments
 (0)