From f4ed8828fb15ff9d240419342a836cfdc9f2c4cb Mon Sep 17 00:00:00 2001 From: Ines WALLON <ines@famillewallon.com> Date: Wed, 9 Apr 2025 02:16:51 +0200 Subject: [PATCH] Issue #3516500 by jonhattan, liber_t: .toolbox/ does not exist in phpmd and phpstan --- .gitlab-ci.yml | 4 ++-- drupal-ci-toolbox-template.yml | 24 +++++++++---------- .../code_quality/phpstan/phpstan.neon.dist | 4 ++++ templates/code_quality/phpstan/template.yml | 1 + templates/global/base.global.yml | 2 +- templates/global/variables.global.yml | 2 +- 6 files changed, 21 insertions(+), 16 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e561fa7..fcedcc0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -35,5 +35,5 @@ workflow: - if: $CI_MERGE_REQUEST_ID # Execute jobs when a new tag is created. - if: $CI_COMMIT_TAG - # Execute jobs when a new commit is pushed to 1.0.x branch. - - if: $CI_COMMIT_BRANCH == '1.0.x' + # Execute jobs when a new commit is pushed to develop branch. + - if: $CI_COMMIT_BRANCH == 'develop' diff --git a/drupal-ci-toolbox-template.yml b/drupal-ci-toolbox-template.yml index f7e1a60..bde9edb 100644 --- a/drupal-ci-toolbox-template.yml +++ b/drupal-ci-toolbox-template.yml @@ -5,17 +5,17 @@ stages: include: # Mandatory file - - remote: https://gitlab.com/ines.wallon/drupal-gitlab-toolbox/-/raw/1.0.x/templates/global/base.global.yml + - remote: https://gitlab.com/ines.wallon/drupal-gitlab-toolbox/-/raw/develop/templates/global/base.global.yml # Security - - remote: https://gitlab.com/ines.wallon/drupal-gitlab-toolbox/-/raw/1.0.x/templates/security/composer_check/template.yml + - remote: https://gitlab.com/ines.wallon/drupal-gitlab-toolbox/-/raw/develop/templates/security/composer_check/template.yml # code_quality - - remote: https://gitlab.com/ines.wallon/drupal-gitlab-toolbox/-/raw/1.0.x/templates/code_quality/composer_normalize/template.yml - - remote: https://gitlab.com/ines.wallon/drupal-gitlab-toolbox/-/raw/1.0.x/templates/code_quality/composer_validate/template.yml - - remote: https://gitlab.com/ines.wallon/drupal-gitlab-toolbox/-/raw/1.0.x/templates/code_quality/php_cs_fixer/template.yml - - remote: https://gitlab.com/ines.wallon/drupal-gitlab-toolbox/-/raw/1.0.x/templates/code_quality/phpcs/template.yml - - remote: https://gitlab.com/ines.wallon/drupal-gitlab-toolbox/-/raw/1.0.x/templates/code_quality/phpmd/template.yml - - remote: https://gitlab.com/ines.wallon/drupal-gitlab-toolbox/-/raw/1.0.x/templates/code_quality/phpstan/template.yml - - remote: https://gitlab.com/ines.wallon/drupal-gitlab-toolbox/-/raw/1.0.x/templates/code_quality/ShellCheck/template.yml - - remote: https://gitlab.com/ines.wallon/drupal-gitlab-toolbox/-/raw/1.0.x/templates/code_quality/css_lint/template.yml - - remote: https://gitlab.com/ines.wallon/drupal-gitlab-toolbox/-/raw/1.0.x/templates/code_quality/js_lint/template.yml - - remote: https://gitlab.com/ines.wallon/drupal-gitlab-toolbox/-/raw/1.0.x/templates/code_quality/yaml_lint/template.yml + - remote: https://gitlab.com/ines.wallon/drupal-gitlab-toolbox/-/raw/develop/templates/code_quality/composer_normalize/template.yml + - remote: https://gitlab.com/ines.wallon/drupal-gitlab-toolbox/-/raw/develop/templates/code_quality/composer_validate/template.yml + - remote: https://gitlab.com/ines.wallon/drupal-gitlab-toolbox/-/raw/develop/templates/code_quality/php_cs_fixer/template.yml + - remote: https://gitlab.com/ines.wallon/drupal-gitlab-toolbox/-/raw/develop/templates/code_quality/phpcs/template.yml + - remote: https://gitlab.com/ines.wallon/drupal-gitlab-toolbox/-/raw/develop/templates/code_quality/phpmd/template.yml + - remote: https://gitlab.com/ines.wallon/drupal-gitlab-toolbox/-/raw/develop/templates/code_quality/phpstan/template.yml + - remote: https://gitlab.com/ines.wallon/drupal-gitlab-toolbox/-/raw/develop/templates/code_quality/ShellCheck/template.yml + - remote: https://gitlab.com/ines.wallon/drupal-gitlab-toolbox/-/raw/develop/templates/code_quality/css_lint/template.yml + - remote: https://gitlab.com/ines.wallon/drupal-gitlab-toolbox/-/raw/develop/templates/code_quality/js_lint/template.yml + - remote: https://gitlab.com/ines.wallon/drupal-gitlab-toolbox/-/raw/develop/templates/code_quality/yaml_lint/template.yml diff --git a/templates/code_quality/phpstan/phpstan.neon.dist b/templates/code_quality/phpstan/phpstan.neon.dist index 6eb412a..4cff425 100644 --- a/templates/code_quality/phpstan/phpstan.neon.dist +++ b/templates/code_quality/phpstan/phpstan.neon.dist @@ -7,6 +7,10 @@ parameters: # Ignore some type hint errors due to hooks that should not have typed hint # parameters or return. ignoreErrors: + - identifier: missingType.generics + - identifier: missingType.iterableValue + # new static() is a best practice in Drupal, so we cannot fix that. + - "#^Unsafe usage of new static#" - message: '#Function [a-zA-Z0-9\\_]+\(\) has parameter \$[a-zA-Z0-9\\_]+ with no typehint specified\.#' paths: diff --git a/templates/code_quality/phpstan/template.yml b/templates/code_quality/phpstan/template.yml index a4b8bef..8e6041b 100644 --- a/templates/code_quality/phpstan/template.yml +++ b/templates/code_quality/phpstan/template.yml @@ -7,6 +7,7 @@ variables: - .cache - .code_quality_default before_script: + - mkdir -p .toolbox/ - ${COMPOSER_BIN} require --working-dir=.toolbox/ --no-interaction --ignore-platform-reqs --no-progress mglaman/phpstan-drupal - test -f phpstan.neon.dist || curl -OL --create-dirs --output-dir .toolbox/ ${TOOLBOX_REF_URL}/templates/code_quality/phpstan/phpstan.neon.dist script: diff --git a/templates/global/base.global.yml b/templates/global/base.global.yml index 66782ec..3bb0916 100644 --- a/templates/global/base.global.yml +++ b/templates/global/base.global.yml @@ -1,5 +1,5 @@ include: - - remote: https://gitlab.com/ines.wallon/drupal-gitlab-toolbox/-/raw/1.0.x/templates/global/variables.global.yml + - remote: https://gitlab.com/ines.wallon/drupal-gitlab-toolbox/-/raw/develop/templates/global/variables.global.yml variables: SKIP_SECURITY: 0 diff --git a/templates/global/variables.global.yml b/templates/global/variables.global.yml index 833bbd0..fd72fac 100644 --- a/templates/global/variables.global.yml +++ b/templates/global/variables.global.yml @@ -1,7 +1,7 @@ variables: DOCKER_CI_PHP_IMAGE: "florenttorregrosa/ci-php:8.3-cli-alpine-node18" DOCKER_CI_NODE_IMAGE: "florenttorregrosa/ci-php:8.3-cli-alpine-node18" - TOOLBOX_VERSION: "1.0.x" + TOOLBOX_VERSION: "develop" #TOOLBOX_REF_URL: https://git.drupalcode.org/project/gitlab_toolbox/-/raw/${TOOLBOX_VERSION} TOOLBOX_REF_URL: https://gitlab.com/ines.wallon/drupal-gitlab-toolbox/-/raw/${TOOLBOX_VERSION} BIN_DIR: "vendor/bin" -- GitLab