Skip to content

Commit

Permalink
setup and adjust lint and lint-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Steffens committed Dec 12, 2023
1 parent 0fb73de commit 3670c52
Show file tree
Hide file tree
Showing 4 changed files with 4,372 additions and 17 deletions.
18 changes: 18 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

declare(strict_types=1);

require_once './vendor/autoload.php';

use Nextcloud\CodingStandard\Config;

$config = new Config();
$config
->getFinder()
->notPath('node_modules')
->notPath('build')
->notPath('l10n')
->notPath('src')
->notPath('vendor')
->in(__DIR__);
return $config;
10 changes: 3 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ app_name=health
project_dir=$(CURDIR)/../$(app_name)
build_dir=$(CURDIR)/build/artifacts
cert_dir=$(HOME)/.nextcloud/certificates
php_dirs=appinfo/ lib/ tests/api/
# php_dirs=appinfo/ lib/ tests/api/
php_dirs=appinfo/ lib/
appstore_build_directory=$(CURDIR)/build/artifacts/appstore
appstore_package_name=$(appstore_build_directory)/$(app_name)

Expand Down Expand Up @@ -124,16 +125,12 @@ lint: lint-php lint-js lint-css lint-xml


lint-php: lint-phpfast lint-php-phan
lint-phpfast: lint-php-lint lint-php-ncversion lint-php-cs-fixer lint-php-phpcs
lint-phpfast: lint-php-lint lint-php-cs-fixer lint-php-phpcs

lint-php-lint:
# Check PHP syntax errors
@! find $(php_dirs) -name "*.php" | xargs -I{} php -l '{}' | grep -v "No syntax errors detected"

lint-php-ncversion:
# Check min-version consistency
php tests/nextcloud-version.php

lint-php-phan:
# PHAN
vendor/bin/phan --allow-polyfill-parser -k tests/phan-config.php --no-progress-bar -m checkstyle | vendor/bin/cs2pr --graceful-warnings --colorize
Expand Down Expand Up @@ -165,7 +162,6 @@ lint-xml:
lint-fix: lint-php-fix lint-js-fix lint-css-fix

lint-php-fix:
vendor/bin/phpcbf --standard=tests/phpcs.xml $(php_dirs)
vendor/bin/php-cs-fixer fix

lint-js-fix:
Expand Down
40 changes: 34 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,43 @@
{
"name": "datenangebot/health",
"description": "Lint config for datenangebot/health",
"license": "MIT",
"type": "project",
"license": "AGPL",
"authors": [
{
"name": "Florian Steffens",
"email": "flost-dev@mailbox.org"
}
],
"config": {
"optimize-autoloader": true,
"classmap-authoritative": true
"classmap-authoritative": true,
"platform": {
"php": "8.1"
}
},
"scripts": {
"lint": "find . -name \\*.php -not -path './vendor/*' -exec php -l \"{}\" \\;"
"test": [
"@test:unit"
],
"test:unit": "./vendor/bin/phpunit -c tests/unit/phpunit.xml",
"lint": "find . -name \\*.php -not -path './vendor/*' -not -path './build/*' -print0 | xargs -0 -n1 php -l",
"cs:check": "php-cs-fixer fix --dry-run --diff",
"cs:fix": "php-cs-fixer fix",
"psalm": "./vendor/bin/psalm --show-info=true --no-cache",
"psalm:update-baseline": "./vendor/bin/psalm --update-baseline",
"psalm:fix": "./vendor/bin/psalm --no-cache --alter --issues=InvalidReturnType,InvalidNullableReturnType,MismatchingDocblockParamType,MismatchingDocblockReturnType,MissingParamType,InvalidFalsableReturnType",
"psalm:fix:dry": "./vendor/bin/psalm --no-cache --alter --issues=InvalidReturnType,InvalidNullableReturnType,MismatchingDocblockParamType,MismatchingDocblockReturnType,MissingParamType,InvalidFalsableReturnType --dry-run"
},
"require": {
"ext-json": "*"
}
"require": {
"ext-json": "*"
},
"require-dev": {
"nextcloud/coding-standard": "^v1.0.0",
"vimeo/psalm": "^5.6.0",
"nextcloud/ocp": "dev-master",
"phan/phan": "5.x",
"staabm/annotate-pull-request-from-checkstyle": "^1.8",
"phpunit/phpunit": "^9"
}
}
Loading

0 comments on commit 3670c52

Please sign in to comment.