Skip to content

Commit b38578b

Browse files
authored
Introduce PHP CS to improve code quality (matomo-org#16755)
* Adds PHP CS with a basic config * automatically check coding style for pull requests * Disallow usage of eval & create_function and force using Common::safe_unserialize instead of unserialize * Forbid inline control structures * fix test
1 parent 6f957d1 commit b38578b

File tree

14 files changed

+446
-17
lines changed

14 files changed

+446
-17
lines changed

.github/workflows/phpcs.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: PHPCS check
2+
3+
on: pull_request
4+
5+
jobs:
6+
phpcs:
7+
name: PHPCS
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
- name: Install dependencies
12+
run: composer install --dev --prefer-dist --no-progress --no-suggest
13+
- name: PHPCS check
14+
uses: chekalsky/phpcs-action@v1
15+
with:
16+
phpcs_bin_path: './vendor/bin/phpcs'
17+
enable_warnings: true

composer.json

+2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@
6161
},
6262
"require-dev": {
6363
"lox/xhprof": "dev-master",
64+
"mayflower/mo4-coding-standard": "~6.0",
6465
"phpunit/phpunit": "~8.5",
66+
"squizlabs/php_codesniffer": "^3.5",
6567
"symfony/var-dumper": "~2.6.0",
6668
"symfony/yaml": "~2.6.0"
6769
},

0 commit comments

Comments
 (0)