Add php cs

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ (skjnldsv) 2020-07-13 12:30:53 +02:00
parent e88fcd0854
commit b8f714a62a
No known key found for this signature in database
GPG Key ID: 60C25B8C072916CF
9 changed files with 2160 additions and 17 deletions

View File

@ -28,6 +28,30 @@ 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
@ -35,7 +59,7 @@ jobs:
matrix:
node-versions: [12.x]
name: node${{ matrix.node-versions }}
name: eslint node${{ matrix.node-versions }}
steps:
- uses: actions/checkout@v2
@ -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
.gitignore vendored
View File

@ -16,3 +16,5 @@ yarn-error.log*
build/
coverage/
vendor
.php_cs.cache

17
.php_cs.dist Normal file
View File

@ -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;

View File

@ -21,4 +21,5 @@
*
*/
use OCA\Photos\AppInfo\Application;
\OC::$server->query(Application::class);

View File

@ -1,12 +1,15 @@
{
"name": "nextcloud/photos",
"description": "Lint config for nextcloud/photos",
"license": "MIT",
"config": {
"optimize-autoloader": true,
"classmap-authoritative": true
},
"scripts": {
"lint": "find . -name \\*.php -not -path './vendor/*' -exec php -l \"{}\" \\;"
}
"name": "nextcloud/photos",
"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"
},
"require-dev": {
"nextcloud/coding-standard": "^0.3.0"
}
}

2074
composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 John Molakvoæ <skjnldsv@protonmail.com>
@ -27,10 +28,9 @@ namespace OCA\Photos\AppInfo;
use OCP\AppFramework\App;
class Application extends App {
public const APP_ID = 'photos';
const APP_ID = 'photos';
const MIMES = [
public const MIMES = [
// 'image/png', // too rarely used for photos
'image/jpeg',
// 'image/gif', // too rarely used for photos

View File

@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019, Roeland Jago Douma <roeland@famdouma.nl>
@ -109,7 +110,7 @@ class AlbumsController extends Controller {
return $result;
}
private function scanCurrentFolder(Folder $folder, bool $shared): iterable {
private function scanCurrentFolder(Folder $folder, bool $shared): iterable {
$nodes = $folder->getDirectoryListing();
// add current folder to iterable set

View File

@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 John Molakvoæ <skjnldsv@protonmail.com>
@ -37,7 +38,6 @@ use OCP\IConfig;
use OCP\App\IAppManager;
class PageController extends Controller {
protected $appName;
/** @var IEventDispatcher */
@ -62,7 +62,6 @@ class PageController extends Controller {
$this->eventDispatcher = $eventDispatcher;
$this->initialStateService = $initialStateService;
$this->config = $config;
}
/**