Skip to content

Commit

Permalink
Add php cs
Browse files Browse the repository at this point in the history
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
  • Loading branch information
skjnldsv committed Jul 9, 2020
1 parent 0141884 commit 73823f4
Show file tree
Hide file tree
Showing 5 changed files with 1,727 additions and 37 deletions.
48 changes: 47 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,38 @@ jobs:
- name: Lint
run: composer run lint

php-cs-fixer:
runs-on: ubuntu-latest

strategy:
matrix:
php-versions: ['7.4']

name: cs php${{ matrix.php-versions }}
steps:
- name: Checkout
uses: actions/checkout@master

- name: Set up php
uses: shivammathur/setup-php@master
with:
php-version: ${{ matrix.php-versions }}
coverage: none

- name: Install dependencies
run: composer i

- name: Run coding standards check
run: composer run cs:check || ( echo 'Please run `composer run cs:fix` to format your code' && exit 1 )

node:
runs-on: ubuntu-latest

strategy:
matrix:
node-versions: [12.x]

name: node${{ matrix.node-versions }}
name: eslint node${{ matrix.node-versions }}
steps:
- uses: actions/checkout@v2

Expand All @@ -49,3 +73,25 @@ jobs:

- name: Lint
run: npm run lint

stylelint:
runs-on: ubuntu-latest

strategy:
matrix:
node-versions: [12.x]

name: stylelint node${{ matrix.node-versions }}
steps:
- uses: actions/checkout@v2

- name: Set up node ${{ matrix.node-versions }}
uses: actions/setup-node@v1
with:
node-versions: ${{ matrix.node-versions }}

- name: Install dependencies
run: npm ci

- name: Lint
run: npm run stylelint
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ js/
build/
coverage*
vendor/

/.php_cs.cache
17 changes: 17 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

declare(strict_types=1);

require_once './vendor/autoload.php';

use Nextcloud\CodingStandard\Config;

$config = new Config();
$config
->getFinder()
->notPath('build')
->notPath('l10n')
->notPath('src')
->notPath('vendor')
->in(__DIR__);
return $config;
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
{
"require-dev": {
"christophwurst/nextcloud_testing": "^0.7.0"
"christophwurst/nextcloud_testing": "^0.7.0",
"nextcloud/coding-standard": "^0.3.0"
},
"config": {
"optimize-autoloader": true,
"classmap-authoritative": true
},
"scripts": {
"cs:fix": "php-cs-fixer fix",
"cs:check": "php-cs-fixer fix --dry-run --diff",
"lint": "find . -name \\*.php -not -path './vendor/*' -print0 | xargs -0 -n1 php -l",
"test:unit": "phpunit -c phpunit.xml --fail-on-warning",
"test:integration": "phpunit -c phpunit.integration.xml --fail-on-warning"
Expand Down
Loading

0 comments on commit 73823f4

Please sign in to comment.