diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 39a7bd496..6c0bf4a52 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -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 diff --git a/.gitignore b/.gitignore index 836ccfd0e..f033bd7ef 100644 --- a/.gitignore +++ b/.gitignore @@ -7,5 +7,5 @@ tests/integration/vendor/ tests/integration/composer.lock vendor/ *.lock - +.php_cs.cache \.idea/ diff --git a/.php_cs.dist b/.php_cs.dist new file mode 100644 index 000000000..3b4fa98f1 --- /dev/null +++ b/.php_cs.dist @@ -0,0 +1,18 @@ +getFinder() +// ->ignoreVCSIgnored(true) + ->notPath('build') + ->notPath('l10n') + ->notPath('src') + ->notPath('vendor') + ->in(__DIR__); +return $config; diff --git a/composer.json b/composer.json index 9a6aced1f..35f80b547 100644 --- a/composer.json +++ b/composer.json @@ -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" } }