Merge pull request #10125 from nupplaphil/feat/ci-lint

Lint & CI: Replace 3rd party library with native PHP linting
This commit is contained in:
Hypolite Petovan 2021-04-05 13:32:06 -04:00 committed by GitHub
commit 9a3a7793f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 59 deletions

20
.github/workflows/lint.yml vendored Normal file
View file

@ -0,0 +1,20 @@
name: Lint
on: pull_request
jobs:
php-linters:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['7.3', '7.4', '8.0']
name: php${{ matrix.php-versions }} lint
steps:
- name: Checkout
uses: actions/checkout@master
- name: Set up php${{ matrix.php-versions }}
uses: shivammathur/setup-php@master
with:
php-version: ${{ matrix.php-versions }}
coverage: none
- name: Lint
run: bin/composer.phar run lint

View file

@ -82,9 +82,6 @@ jobs:
run: | run: |
mysql -h"127.0.0.1" -P"$PORT" -utest -ptest test < database.sql mysql -h"127.0.0.1" -P"$PORT" -utest -ptest test < database.sql
- name: Test with Parallel-lint
run: vendor/bin/parallel-lint --exclude vendor/ --exclude view/asset/ .
- name: Test with phpunit - name: Test with phpunit
run: $(git rev-parse --show-toplevel)/bin/phpunit --configuration tests/phpunit.xml --coverage-clover clover.xml run: $(git rev-parse --show-toplevel)/bin/phpunit --configuration tests/phpunit.xml --coverage-clover clover.xml
env: env:

View file

@ -124,11 +124,11 @@
] ]
}, },
"require-dev": { "require-dev": {
"php-parallel-lint/php-parallel-lint": "^1.2",
"mockery/mockery": "^1.3", "mockery/mockery": "^1.3",
"mikey179/vfsstream": "^1.6" "mikey179/vfsstream": "^1.6"
}, },
"scripts": { "scripts": {
"test": "phpunit" "test": "phpunit",
"lint": "find . -name \\*.php -not -path './vendor/*' -not -path './view/asset/*' -print0 | xargs -0 -n1 php -l"
} }
} }

55
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "355e17099c031793ea039e702acbb0d7", "content-hash": "5cf680863afa011d3c2c9f4e0b817690",
"packages": [ "packages": [
{ {
"name": "asika/simple-console", "name": "asika/simple-console",
@ -3978,59 +3978,6 @@
"testing" "testing"
], ],
"time": "2021-02-24T09:51:00+00:00" "time": "2021-02-24T09:51:00+00:00"
},
{
"name": "php-parallel-lint/php-parallel-lint",
"version": "v1.2.0",
"source": {
"type": "git",
"url": "https://github.com/php-parallel-lint/PHP-Parallel-Lint.git",
"reference": "474f18bc6cc6aca61ca40bfab55139de614e51ca"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-parallel-lint/PHP-Parallel-Lint/zipball/474f18bc6cc6aca61ca40bfab55139de614e51ca",
"reference": "474f18bc6cc6aca61ca40bfab55139de614e51ca",
"shasum": ""
},
"require": {
"ext-json": "*",
"php": ">=5.4.0"
},
"replace": {
"grogy/php-parallel-lint": "*",
"jakub-onderka/php-parallel-lint": "*"
},
"require-dev": {
"nette/tester": "^1.3 || ^2.0",
"php-parallel-lint/php-console-highlighter": "~0.3",
"squizlabs/php_codesniffer": "~3.0"
},
"suggest": {
"php-parallel-lint/php-console-highlighter": "Highlight syntax in code snippet"
},
"bin": [
"parallel-lint"
],
"type": "library",
"autoload": {
"classmap": [
"./"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-2-Clause"
],
"authors": [
{
"name": "Jakub Onderka",
"email": "ahoj@jakubonderka.cz"
}
],
"description": "This tool check syntax of PHP files about 20x faster than serial check.",
"homepage": "https://github.com/php-parallel-lint/PHP-Parallel-Lint",
"time": "2020-04-04T12:18:32+00:00"
} }
], ],
"aliases": [], "aliases": [],