Commit 2304f68e authored by Ines WALLON's avatar Ines WALLON
Browse files

phpstan

parent 249484b6
Pipeline #697 canceled with stage
......@@ -111,6 +111,10 @@ quality-phpcs:
@docker-compose exec web bash ${WORK_DIR}/scripts/test-phpcs.sh "$(filter-out $@,$(MAKECMDGOALS))"
@make resetOwner
quality-phpstan:
@docker-compose exec web phpstan analyse -c ${WORK_DIR}/scripts/quality/phpstan.neon.dist "$(filter-out $@,$(MAKECMDGOALS))"
@make resetOwner
logs:
@docker-compose logs -f
......
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "abdf77f371af5fcd0b3ab11ca90a039b",
"content-hash": "112ddde224334f89017ff763134e52d9",
"packages": [
{
"name": "asm89/stack-cors",
......@@ -8618,79 +8618,6 @@
],
"time": "2021-01-27T15:09:27+00:00"
},
{
"name": "composer/package-versions-deprecated",
"version": "1.11.99.1",
"source": {
"type": "git",
"url": "https://github.com/composer/package-versions-deprecated.git",
"reference": "7413f0b55a051e89485c5cb9f765fe24bb02a7b6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/7413f0b55a051e89485c5cb9f765fe24bb02a7b6",
"reference": "7413f0b55a051e89485c5cb9f765fe24bb02a7b6",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.1.0 || ^2.0",
"php": "^7 || ^8"
},
"replace": {
"ocramius/package-versions": "1.11.99"
},
"require-dev": {
"composer/composer": "^1.9.3 || ^2.0@dev",
"ext-zip": "^1.13",
"phpunit/phpunit": "^6.5 || ^7"
},
"type": "composer-plugin",
"extra": {
"class": "PackageVersions\\Installer",
"branch-alias": {
"dev-master": "1.x-dev"
}
},
"autoload": {
"psr-4": {
"PackageVersions\\": "src/PackageVersions"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Marco Pivetta",
"email": "ocramius@gmail.com"
},
{
"name": "Jordi Boggiano",
"email": "j.boggiano@seld.be"
}
],
"description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)",
"support": {
"issues": "https://github.com/composer/package-versions-deprecated/issues",
"source": "https://github.com/composer/package-versions-deprecated/tree/1.11.99.1"
},
"funding": [
{
"url": "https://packagist.com",
"type": "custom"
},
{
"url": "https://github.com/composer",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/composer/composer",
"type": "tidelift"
}
],
"time": "2020-11-11T10:22:58+00:00"
},
{
"name": "composer/spdx-licenses",
"version": "1.5.5",
......@@ -9719,61 +9646,6 @@
},
"time": "2019-09-25T09:05:11+00:00"
},
{
"name": "jean85/pretty-package-versions",
"version": "1.5.1",
"source": {
"type": "git",
"url": "https://github.com/Jean85/pretty-package-versions.git",
"reference": "a917488320c20057da87f67d0d40543dd9427f7a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Jean85/pretty-package-versions/zipball/a917488320c20057da87f67d0d40543dd9427f7a",
"reference": "a917488320c20057da87f67d0d40543dd9427f7a",
"shasum": ""
},
"require": {
"composer/package-versions-deprecated": "^1.8.0",
"php": "^7.0|^8.0"
},
"require-dev": {
"phpunit/phpunit": "^6.0|^8.5|^9.2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
}
},
"autoload": {
"psr-4": {
"Jean85\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Alessandro Lai",
"email": "alessandro.lai85@gmail.com"
}
],
"description": "A wrapper for ocramius/package-versions to get pretty versions strings",
"keywords": [
"composer",
"package",
"release",
"versions"
],
"support": {
"issues": "https://github.com/Jean85/pretty-package-versions/issues",
"source": "https://github.com/Jean85/pretty-package-versions/tree/1.5.1"
},
"time": "2020-09-14T08:43:34+00:00"
},
{
"name": "justinrainbow/json-schema",
"version": "5.2.10",
......@@ -9845,72 +9717,57 @@
"time": "2020-05-27T16:41:55+00:00"
},
{
"name": "mglaman/drupal-check",
"version": "1.1.7",
"name": "mavimo/phpstan-junit",
"version": "0.3.0",
"source": {
"type": "git",
"url": "https://github.com/mglaman/drupal-check.git",
"reference": "af5d3cba507128bb2f730862e324eb9127085090"
"url": "https://github.com/mavimo/phpstan-junit.git",
"reference": "121db52bd8cc9493f9d44204ea5a741dc543b3b7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mglaman/drupal-check/zipball/af5d3cba507128bb2f730862e324eb9127085090",
"reference": "af5d3cba507128bb2f730862e324eb9127085090",
"url": "https://api.github.com/repos/mavimo/phpstan-junit/zipball/121db52bd8cc9493f9d44204ea5a741dc543b3b7",
"reference": "121db52bd8cc9493f9d44204ea5a741dc543b3b7",
"shasum": ""
},
"require": {
"composer/xdebug-handler": "^1.3",
"jean85/pretty-package-versions": "~1.5.0",
"mglaman/phpstan-drupal": "^0.12.8",
"nette/neon": "^3.1",
"php": "~7.2",
"phpstan/phpstan-deprecation-rules": "^0.12",
"symfony/console": "~3.2 || ~4.0",
"symfony/process": "~3.2 || ~4.0",
"webflo/drupal-finder": "^1.1"
"php": "~7.1",
"phpstan/phpstan": "^0.12"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.4"
"phpstan/phpstan": "^0.12-dev",
"phpunit/phpunit": "^8.0",
"slevomat/coding-standard": "^6.0"
},
"type": "phpstan-extension",
"extra": {
"phpstan": {
"includes": [
"extension.neon"
]
}
},
"bin": [
"drupal-check"
],
"type": "project",
"autoload": {
"psr-4": {
"DrupalCheck\\": "src"
"Mavimo\\PHPStan\\ErrorFormatter\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"GPL-2.0-or-later"
"MIT"
],
"authors": [
{
"name": "Matt Glaman",
"email": "nmd.matt@gmail.com"
"name": "Marco Vito Moscaritolo",
"email": "mavimo@gmail.com"
}
],
"description": "CLI tool for running checks on a Drupal code base",
"description": "PHPStan JUnit error reporter",
"support": {
"issues": "https://github.com/mglaman/drupal-check/issues",
"source": "https://github.com/mglaman/drupal-check/tree/1.1.7"
"issues": "https://github.com/mavimo/phpstan-junit/issues",
"source": "https://github.com/mavimo/phpstan-junit/tree/master"
},
"funding": [
{
"url": "https://github.com/mglaman",
"type": "github"
},
{
"url": "https://ko-fi.com/mglaman",
"type": "ko_fi"
},
{
"url": "https://tidelift.com/funding/github/packagist/mglaman/drupal-check",
"type": "tidelift"
}
],
"time": "2021-02-06T02:13:19+00:00"
"time": "2019-12-07T16:37:07+00:00"
},
{
"name": "mglaman/phpstan-drupal",
......@@ -10185,72 +10042,6 @@
},
"time": "2020-01-03T20:35:40+00:00"
},
{
"name": "nette/neon",
"version": "v3.2.1",
"source": {
"type": "git",
"url": "https://github.com/nette/neon.git",
"reference": "a5b3a60833d2ef55283a82d0c30b45d136b29e75"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nette/neon/zipball/a5b3a60833d2ef55283a82d0c30b45d136b29e75",
"reference": "a5b3a60833d2ef55283a82d0c30b45d136b29e75",
"shasum": ""
},
"require": {
"ext-iconv": "*",
"ext-json": "*",
"php": ">=7.1"
},
"require-dev": {
"nette/tester": "^2.0",
"phpstan/phpstan": "^0.12",
"tracy/tracy": "^2.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.2-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause",
"GPL-2.0-only",
"GPL-3.0-only"
],
"authors": [
{
"name": "David Grudl",
"homepage": "https://davidgrudl.com"
},
{
"name": "Nette Community",
"homepage": "https://nette.org/contributors"
}
],
"description": "🍸 Nette NEON: encodes and decodes NEON file format.",
"homepage": "https://ne-on.org",
"keywords": [
"export",
"import",
"neon",
"nette",
"yaml"
],
"support": {
"issues": "https://github.com/nette/neon/issues",
"source": "https://github.com/nette/neon/tree/master"
},
"time": "2020-07-31T12:28:05+00:00"
},
{
"name": "nette/utils",
"version": "v3.2.1",
......@@ -10726,16 +10517,16 @@
},
{
"name": "phpstan/phpstan",
"version": "0.12.74",
"version": "0.12.75",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
"reference": "bc5f9483c8f461c86653dcbd040cf0d2778c91a2"
"reference": "2e4738cd67e0163861a065180eff7eb5c8417d6e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/bc5f9483c8f461c86653dcbd040cf0d2778c91a2",
"reference": "bc5f9483c8f461c86653dcbd040cf0d2778c91a2",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/2e4738cd67e0163861a065180eff7eb5c8417d6e",
"reference": "2e4738cd67e0163861a065180eff7eb5c8417d6e",
"shasum": ""
},
"require": {
......@@ -10766,7 +10557,7 @@
"description": "PHPStan - PHP Static Analysis Tool",
"support": {
"issues": "https://github.com/phpstan/phpstan/issues",
"source": "https://github.com/phpstan/phpstan/tree/0.12.74"
"source": "https://github.com/phpstan/phpstan/tree/0.12.75"
},
"funding": [
{
......@@ -10782,58 +10573,7 @@
"type": "tidelift"
}
],
"time": "2021-02-08T15:00:25+00:00"
},
{
"name": "phpstan/phpstan-deprecation-rules",
"version": "0.12.6",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan-deprecation-rules.git",
"reference": "46dbd43c2db973d2876d6653e53f5c2cc3a01fbb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/46dbd43c2db973d2876d6653e53f5c2cc3a01fbb",
"reference": "46dbd43c2db973d2876d6653e53f5c2cc3a01fbb",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0",
"phpstan/phpstan": "^0.12.60"
},
"require-dev": {
"phing/phing": "^2.16.3",
"php-parallel-lint/php-parallel-lint": "^1.2",
"phpstan/phpstan-phpunit": "^0.12",
"phpunit/phpunit": "^7.5.20"
},
"type": "phpstan-extension",
"extra": {
"branch-alias": {
"dev-master": "0.12-dev"
},
"phpstan": {
"includes": [
"rules.neon"
]
}
},
"autoload": {
"psr-4": {
"PHPStan\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "PHPStan rules for detecting usage of deprecated classes, methods, properties, constants and traits.",
"support": {
"issues": "https://github.com/phpstan/phpstan-deprecation-rules/issues",
"source": "https://github.com/phpstan/phpstan-deprecation-rules/tree/0.12.6"
},
"time": "2020-12-13T10:20:54+00:00"
"time": "2021-02-11T13:58:47+00:00"
},
{
"name": "phpunit/php-code-coverage",
......
......@@ -4,7 +4,6 @@
tags:
- spud
script:
- mkdir /usr/local/composer || true
- echo $COMPOSER_AUTH > /usr/local/composer/auth.json
- cp config/.init_files/exemple.docker-compose.yml docker-compose.yml
- cp config/.init_files/exemple.env .env
......
......@@ -2,47 +2,41 @@
stage: Code quality PHP 7.4
image: libert/drupal-php-dev:7.4
needs: ['Build Drupal']
tags:
- spud
rules:
- if: $CI_COMMIT_BRANCH == "contrib_modules"
PHPCS:
extends: .code_quality_default
tags:
- spud
script:
- phpcs --standard=./scripts/quality/phpcs.xml.dist --report-junit=./phpcs.xml web/modules/contrib_project/
artifacts:
when: always
reports:
junit: phpcs.xml
rules:
- if: $CI_COMMIT_BRANCH == "contrib_modules"
PHPMD:
extends: .code_quality_default
tags:
- spud
script:
- phpmd web/modules/contrib_project/ ansi scripts/quality/phpmd.xml
rules:
- if: $CI_COMMIT_BRANCH == "contrib_modules"
PHPCPD:
extends: .code_quality_default
tags:
- spud
script:
- phpcpd web/modules/contrib_project/
rules:
- if: $CI_COMMIT_BRANCH == "contrib_modules"
PHPStan:
extends: .code_quality_default
tags:
- spud
script:
- ./vendor/bin/drupal-check --memory-limit 512M --format=junit -d web/modules/contrib_project/ > phpstan.xml
- ./vendor/bin/phpstan
analyse
-c ./scripts/quality/phpstan.neon.dist
--error-format=junit
--no-progress
--memory-limit=-1
web/modules/contrib_project/ > phpstan.xml
artifacts:
when: always
reports:
junit: phpstan.xml
rules:
- if: $CI_COMMIT_BRANCH == "contrib_modules"
......@@ -2,51 +2,43 @@
stage: Code quality PHP 8.0
image: libert/drupal-php-dev:8.0
needs: ['Build Drupal']
tags:
- spud
rules:
- if: $CI_COMMIT_BRANCH == "contrib_modules"
PHPCS PHP8:
extends: .code_quality_php8
tags:
- spud
script:
- phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md web/modules/contrib_project/ --report-junit=./phpcs.xml
artifacts:
when: always
reports:
junit: phpcs.xml
rules:
- if: $CI_COMMIT_BRANCH == "contrib_modules"
PHPMD PHP8:
extends: .code_quality_php8
tags:
- spud
script:
- phpmd web/modules/contrib_project/ ansi scripts/quality/phpmd.xml
rules:
- if: $CI_COMMIT_BRANCH == "contrib_modules"
PHPCPD PHP8:
extends: .code_quality_php8
tags:
- spud
script:
- phpcpd web/modules/contrib_project/ --log-pmd phpcpd.xml
artifacts:
when: always
reports:
junit: phpcpd.xml
rules:
- if: $CI_COMMIT_BRANCH == "contrib_modules"
- phpcpd web/modules/contrib_project/
PHPStan PHP8:
extends: .code_quality_php8
tags:
- spud
script:
- ./vendor/bin/drupal-check --memory-limit 512M --format=junit -d web/modules/contrib_project/ > phpstan.xml
# fix TypeError in php8.
- composer require mglaman/phpstan-drupal:dev-master#97c10db --dev
- ./vendor/bin/phpstan
analyse
-c ./scripts/quality/phpstan.neon.dist
--error-format=junit
--no-progress
--memory-limit=-1
web/modules/contrib_project/ > phpstan.xml
artifacts:
when: always
reports:
junit: phpstan.xml
rules:
- if: $CI_COMMIT_BRANCH == "contrib_modules"
......@@ -7,6 +7,7 @@
- sed -i "s/FIXUID=1000/FIXUID=0/g" .env
- sed -i "s/FIXGID=1000/FIXGID=0/g" .env
- sed -i '/COMPOSER_AUTH/d' .env
- echo COMPOSER_AUTH=$COMPOSER_AUTH >> .env
- echo CMIS_URL_NUXEO=$CMIS_URL_NUXEO >> .env
- echo CMIS_URL_ALFRESCO=$CMIS_URL_ALFRESCO >> .env
- docker network create drupalci_nw
......@@ -14,6 +15,8 @@
- sleep 30
- $WEB_CONTAINER composer update
- $WEB_CONTAINER bash /project/scripts/install.sh "skeletond9" "d9@example.com"
rules:
- if: $CI_COMMIT_BRANCH == "contrib_modules"
'PHPUnit : CMIS':
extends: .phpunit_default
......@@ -27,8 +30,6 @@
when: always
reports:
junit: phpunit_cmis.xml
rules:
- if: $CI_COMMIT_BRANCH == "contrib_modules"
'PHPUnit : Theme permission':
extends: .phpunit_default
......@@ -40,8 +41,6 @@
when: always
reports:
junit: phpunit_theme_permission.xml
rules:
- if: $CI_COMMIT_BRANCH == "contrib_modules"
'PHPUnit : paragraphs Usage':
extends: .phpunit_default
......@@ -53,5 +52,3 @@
when: always
reports:
junit: phpunit_paragraphs_usage.xml
rules:
- if: $CI_COMMIT_BRANCH == "contrib_modules"
......@@ -185,6 +185,7 @@ LoadModule dir_module modules/mod_dir.so
#LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule mpm_event_module modules/mod_mpm_event.so
<IfModule unixd_module>
#
......
includes:
- ../../vendor/mglaman/phpstan-drupal/extension.neon
- ../../vendor/mavimo/phpstan-junit/extension.neon
parameters:
checkMissingIterableValueType: false
excludes_analyse:
- */tests/*
- */bower_components/*
- */node_modules/*
# Ignore some type hint errors due to hooks that should not have typed hint
# parameters or return.
ignoreErrors:
-
message: '#Function [a-zA-Z0-9\\_]+\(\) has parameter \$[a-zA-Z0-9\\_]+ with no typehint specified\.#'
paths:
- *.inc