Add php-cs check

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2020-04-22 19:56:51 +02:00
parent 5d0440aee7
commit 7ad5daabeb
4 changed files with 40 additions and 3 deletions

View File

@@ -26,6 +26,22 @@ jobs:
- name: Lint
run: composer run lint
php-cs-fixer:
name: php-cs check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Set up php
uses: shivammathur/setup-php@master
with:
php-version: 7.4
coverage: none
- name: Install dependencies
run: composer i
- name: Run coding standards check
run: composer run cs:check
node:
runs-on: ubuntu-latest

2
.gitignore vendored
View File

@@ -7,5 +7,5 @@ tests/integration/vendor/
tests/integration/composer.lock
vendor/
*.lock
.php_cs.cache
\.idea/

18
.php_cs.dist Normal file
View File

@@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
require_once './vendor/autoload.php';
use Nextcloud\CodingStandard\Config;
$config = new Config();
$config
->getFinder()
// ->ignoreVCSIgnored(true)
->notPath('build')
->notPath('l10n')
->notPath('src')
->notPath('vendor')
->in(__DIR__);
return $config;

View File

@@ -15,13 +15,16 @@
"roave/security-advisories": "dev-master",
"christophwurst/nextcloud": "^17",
"jakub-onderka/php-parallel-lint": "^1.0.0",
"phpunit/phpunit": "^8"
"phpunit/phpunit": "^8",
"nextcloud/coding-standard": "^0.3.0"
},
"config": {
"optimize-autoloader": true,
"classmap-authoritative": true
},
"scripts": {
"lint": "find . -name \\*.php -not -path './vendor/*' -exec php -l \"{}\" \\;"
"lint": "find . -name \\*.php -not -path './vendor/*' -exec php -l \"{}\" \\;",
"cs:check": "php-cs-fixer fix --dry-run --diff",
"cs:fix": "php-cs-fixer fix"
}
}