Issue #3387339 by bbrala, longwave: Integrate codequality reports into Gitlab

merge-requests/4828/head
catch 2023-09-19 14:27:24 +01:00
parent dce60220c1
commit 8224c90c08
8 changed files with 140 additions and 9 deletions

View File

@ -248,8 +248,7 @@ stages:
paths: paths:
- core/node_modules/ - core/node_modules/
script: script:
# Installs all core javascript dependencies and adds junit formatter. - yarn --cwd ./core install
- yarn --cwd ./core add stylelint-junit-formatter
################ ################
# Lint Jobs # Lint Jobs
@ -259,20 +258,31 @@ stages:
<<: [ *with-composer-cache, *junit-artifacts, *default-job-settings-lint ] <<: [ *with-composer-cache, *junit-artifacts, *default-job-settings-lint ]
stage: 🪄 Lint stage: 🪄 Lint
script: script:
- composer phpcs -- --report-junit=junit.xml --report-full --report-summary - composer phpcs -- --report-full --report-summary --report-\\Micheh\\PhpCodeSniffer\\Report\\Gitlab=phpcs-quality-report.json
artifacts:
reports:
codequality: phpcs-quality-report.json
'🧹 PHP Static Analysis (phpstan)': '🧹 PHP Static Analysis (phpstan)':
<<: [ *with-composer-cache, *junit-artifacts, *default-job-settings-lint ] <<: [ *with-composer-cache, *junit-artifacts, *default-job-settings-lint ]
stage: 🪄 Lint stage: 🪄 Lint
script: script:
# Turn off apc to avoid corrupt composer cache. # Turn off apc to avoid corrupt composer cache.
- php -d apc.enabled=0 -d apc.enable_cli=0 vendor/bin/phpstan analyze --configuration=./core/phpstan.neon.dist --error-format=junit > junit.xml - php -d apc.enabled=0 -d apc.enable_cli=0 vendor/bin/phpstan analyze --configuration=./core/phpstan.neon.dist --error-format=gitlab > phpstan-quality-report.json
artifacts:
reports:
codequality: phpstan-quality-report.json
'🧹 CSS linting (stylelint)': '🧹 CSS linting (stylelint)':
<<: [ *with-yarn-cache, *junit-artifacts, *default-job-settings-lint ] <<: [ *with-yarn-cache, *junit-artifacts, *default-job-settings-lint ]
stage: 🪄 Lint stage: 🪄 Lint
variables:
STYLELINT_CODE_QUALITY_REPORT: ../stylelint-quality-report.json
script: script:
- yarn run --cwd=./core lint:css --color --custom-formatter node_modules/stylelint-junit-formatter > junit.xml - yarn run --cwd=./core lint:css --color --custom-formatter=node_modules/stylelint-formatter-gitlab
artifacts:
reports:
codequality: stylelint-quality-report.json
'🧹 Compilation check': '🧹 Compilation check':
<<: [ *with-yarn-cache, *default-job-settings-lint ] <<: [ *with-yarn-cache, *default-job-settings-lint ]
@ -284,8 +294,13 @@ stages:
'🧹 JavaScript linting (eslint)': '🧹 JavaScript linting (eslint)':
<<: [ *with-yarn-cache, *junit-artifacts, *default-job-settings-lint ] <<: [ *with-yarn-cache, *junit-artifacts, *default-job-settings-lint ]
stage: 🪄 Lint stage: 🪄 Lint
variables:
ESLINT_CODE_QUALITY_REPORT: ../eslint-quality-report.json
script: script:
- yarn --cwd=./core run -s lint:core-js-passing --format junit > junit.xml - yarn --cwd=./core run -s lint:core-js-passing --format gitlab
artifacts:
reports:
codequality: eslint-quality-report.json
'📔 Spell-checking': '📔 Spell-checking':
<<: [ *with-yarn-cache, *default-job-settings-lint ] <<: [ *with-yarn-cache, *default-job-settings-lint ]

View File

@ -24,6 +24,7 @@
"instaclick/php-webdriver": "^1.4.1", "instaclick/php-webdriver": "^1.4.1",
"justinrainbow/json-schema": "^5.2", "justinrainbow/json-schema": "^5.2",
"mglaman/phpstan-drupal": "^1.2", "mglaman/phpstan-drupal": "^1.2",
"micheh/phpcs-gitlab": "^1.1",
"mikey179/vfsstream": "^1.6.11", "mikey179/vfsstream": "^1.6.11",
"open-telemetry/exporter-otlp": "@beta", "open-telemetry/exporter-otlp": "@beta",
"open-telemetry/sdk": "@beta", "open-telemetry/sdk": "@beta",

54
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "f3f72146ac9ba2de4360c6b6ba23518b", "content-hash": "bfd416e5a3556fed83f84928cf81fa18",
"packages": [ "packages": [
{ {
"name": "asm89/stack-cors", "name": "asm89/stack-cors",
@ -5518,6 +5518,58 @@
], ],
"time": "2023-08-24T20:32:56+00:00" "time": "2023-08-24T20:32:56+00:00"
}, },
{
"name": "micheh/phpcs-gitlab",
"version": "1.1.0",
"source": {
"type": "git",
"url": "https://github.com/micheh/phpcs-gitlab.git",
"reference": "fd64e6579d9e30a82abba616fabcb9a2c837c7a8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/micheh/phpcs-gitlab/zipball/fd64e6579d9e30a82abba616fabcb9a2c837c7a8",
"reference": "fd64e6579d9e30a82abba616fabcb9a2c837c7a8",
"shasum": ""
},
"require": {
"ext-json": "*"
},
"require-dev": {
"phpunit/phpunit": "^8.0 || ^9.0",
"squizlabs/php_codesniffer": "^3.3.1",
"vimeo/psalm": "^4.3"
},
"type": "library",
"autoload": {
"psr-4": {
"Micheh\\PhpCodeSniffer\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Michel Hunziker",
"email": "info@michelhunziker.com"
}
],
"description": "Gitlab Report for PHP_CodeSniffer (display the violations in the Gitlab CI/CD Code Quality Report)",
"keywords": [
"PHP_CodeSniffer",
"code quality",
"gitlab",
"phpcs",
"report"
],
"support": {
"issues": "https://github.com/micheh/phpcs-gitlab/issues",
"source": "https://github.com/micheh/phpcs-gitlab/tree/1.1.0"
},
"time": "2020-12-20T09:39:07+00:00"
},
{ {
"name": "mikey179/vfsstream", "name": "mikey179/vfsstream",
"version": "v1.6.11", "version": "v1.6.11",

View File

@ -16,6 +16,7 @@
"instaclick/php-webdriver": "^1.4.1", "instaclick/php-webdriver": "^1.4.1",
"justinrainbow/json-schema": "^5.2", "justinrainbow/json-schema": "^5.2",
"mglaman/phpstan-drupal": "^1.2", "mglaman/phpstan-drupal": "^1.2",
"micheh/phpcs-gitlab": "^1.1",
"mikey179/vfsstream": "^1.6.11", "mikey179/vfsstream": "^1.6.11",
"open-telemetry/exporter-otlp": "@beta", "open-telemetry/exporter-otlp": "@beta",
"open-telemetry/sdk": "@beta", "open-telemetry/sdk": "@beta",

View File

@ -26,6 +26,7 @@
"instaclick/php-webdriver": "1.4.16", "instaclick/php-webdriver": "1.4.16",
"justinrainbow/json-schema": "5.2.12", "justinrainbow/json-schema": "5.2.12",
"mglaman/phpstan-drupal": "1.2.0", "mglaman/phpstan-drupal": "1.2.0",
"micheh/phpcs-gitlab": "1.1.0",
"mikey179/vfsstream": "v1.6.11", "mikey179/vfsstream": "v1.6.11",
"myclabs/deep-copy": "1.11.1", "myclabs/deep-copy": "1.11.1",
"nikic/php-parser": "v4.15.5", "nikic/php-parser": "v4.15.5",

View File

@ -671,6 +671,7 @@ metatag
metatags metatags
meφω meφω
mglaman mglaman
micheh
mikey mikey
milli milli
mimetypes mimetypes

View File

@ -63,6 +63,7 @@
"eslint": "^8.44.0", "eslint": "^8.44.0",
"eslint-config-airbnb-base": "^15.0.0", "eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^8.4.0", "eslint-config-prettier": "^8.4.0",
"eslint-formatter-gitlab": "^5.0.0",
"eslint-plugin-import": "^2.25.4", "eslint-plugin-import": "^2.25.4",
"eslint-plugin-jquery": "^1.5.1", "eslint-plugin-jquery": "^1.5.1",
"eslint-plugin-prettier": "^4.0.0", "eslint-plugin-prettier": "^4.0.0",
@ -90,12 +91,13 @@
"stylelint": "^15.10.1", "stylelint": "^15.10.1",
"stylelint-checkstyle-formatter": "^0.1.2", "stylelint-checkstyle-formatter": "^0.1.2",
"stylelint-config-standard": "^33.0.0", "stylelint-config-standard": "^33.0.0",
"stylelint-formatter-gitlab": "^1.0.2",
"stylelint-order": "^6.0.3", "stylelint-order": "^6.0.3",
"tabbable": "^6.1.2", "tabbable": "^6.1.2",
"terser": "^5.19.0", "terser": "^5.19.0",
"terser-webpack-plugin": "^5.3.9", "terser-webpack-plugin": "^5.3.9",
"tua-body-scroll-lock": "^1.4.0",
"transliteration": "^2.3.5", "transliteration": "^2.3.5",
"tua-body-scroll-lock": "^1.4.0",
"underscore": "~1.13.4", "underscore": "~1.13.4",
"webpack": "^5.85.1", "webpack": "^5.85.1",
"webpack-cli": "^5.1.3" "webpack-cli": "^5.1.3"

View File

@ -1356,6 +1356,13 @@ anymatch@~3.1.2:
normalize-path "^3.0.0" normalize-path "^3.0.0"
picomatch "^2.0.4" picomatch "^2.0.4"
argparse@^1.0.7:
version "1.0.10"
resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911"
integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==
dependencies:
sprintf-js "~1.0.2"
argparse@^2.0.1: argparse@^2.0.1:
version "2.0.1" version "2.0.1"
resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38"
@ -2345,6 +2352,14 @@ eslint-config-prettier@^8.4.0:
resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.8.0.tgz#bfda738d412adc917fd7b038857110efe98c9348" resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.8.0.tgz#bfda738d412adc917fd7b038857110efe98c9348"
integrity sha512-wLbQiFre3tdGgpDv67NQKnJuTlcUVYHas3k+DZCc2U2BadthoEY4B7hLPvAxaqdyOGCzuLfii2fqGph10va7oA== integrity sha512-wLbQiFre3tdGgpDv67NQKnJuTlcUVYHas3k+DZCc2U2BadthoEY4B7hLPvAxaqdyOGCzuLfii2fqGph10va7oA==
eslint-formatter-gitlab@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/eslint-formatter-gitlab/-/eslint-formatter-gitlab-5.0.0.tgz#321989900adb17d2d31164abba62d3c2b43f6807"
integrity sha512-4mF/Bam1xAzsNNYE7kWN/qBQD4mSMkDBEw5AoMLY4oU5iY7BxTxcAzs253FNnUKc5FvduD4Q4+/RW9l1xjz7Zg==
dependencies:
chalk "^4.0.0"
yaml "^2.0.0"
eslint-import-resolver-node@^0.3.7: eslint-import-resolver-node@^0.3.7:
version "0.3.7" version "0.3.7"
resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.7.tgz#83b375187d412324a1963d84fa664377a23eb4d7" resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.7.tgz#83b375187d412324a1963d84fa664377a23eb4d7"
@ -2479,7 +2494,7 @@ espree@^9.6.0:
acorn-jsx "^5.3.2" acorn-jsx "^5.3.2"
eslint-visitor-keys "^3.4.1" eslint-visitor-keys "^3.4.1"
esprima@^4.0.1: esprima@^4.0.0, esprima@^4.0.1:
version "4.0.1" version "4.0.1"
resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71"
integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==
@ -2651,6 +2666,15 @@ fs-extra@^10.1.0:
jsonfile "^6.0.1" jsonfile "^6.0.1"
universalify "^2.0.0" universalify "^2.0.0"
fs-extra@^8.1.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0"
integrity sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==
dependencies:
graceful-fs "^4.2.0"
jsonfile "^4.0.0"
universalify "^0.1.0"
fs.realpath@^1.0.0: fs.realpath@^1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
@ -3323,6 +3347,14 @@ js-yaml@4.1.0, js-yaml@^4.1.0:
dependencies: dependencies:
argparse "^2.0.1" argparse "^2.0.1"
js-yaml@^3.13.1:
version "3.14.1"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537"
integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==
dependencies:
argparse "^1.0.7"
esprima "^4.0.0"
jsdom@^22.1.0: jsdom@^22.1.0:
version "22.1.0" version "22.1.0"
resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-22.1.0.tgz#0fca6d1a37fbeb7f4aac93d1090d782c56b611c8" resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-22.1.0.tgz#0fca6d1a37fbeb7f4aac93d1090d782c56b611c8"
@ -3379,6 +3411,13 @@ json5@^1.0.2:
dependencies: dependencies:
minimist "^1.2.0" minimist "^1.2.0"
jsonfile@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb"
integrity sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==
optionalDependencies:
graceful-fs "^4.1.6"
jsonfile@^6.0.1: jsonfile@^6.0.1:
version "6.1.0" version "6.1.0"
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae" resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae"
@ -4853,6 +4892,11 @@ spdx-license-ids@^3.0.0:
resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.13.tgz#7189a474c46f8d47c7b0da4b987bb45e908bd2d5" resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.13.tgz#7189a474c46f8d47c7b0da4b987bb45e908bd2d5"
integrity sha512-XkD+zwiqXHikFZm4AX/7JSCXA98U5Db4AFd5XUg/+9UNtnH75+Z9KxtpYiJZx36mUDVOwH83pl7yvCer6ewM3w== integrity sha512-XkD+zwiqXHikFZm4AX/7JSCXA98U5Db4AFd5XUg/+9UNtnH75+Z9KxtpYiJZx36mUDVOwH83pl7yvCer6ewM3w==
sprintf-js@~1.0.2:
version "1.0.3"
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
integrity sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==
stacktrace-parser@0.1.10: stacktrace-parser@0.1.10:
version "0.1.10" version "0.1.10"
resolved "https://registry.yarnpkg.com/stacktrace-parser/-/stacktrace-parser-0.1.10.tgz#29fb0cae4e0d0b85155879402857a1639eb6051a" resolved "https://registry.yarnpkg.com/stacktrace-parser/-/stacktrace-parser-0.1.10.tgz#29fb0cae4e0d0b85155879402857a1639eb6051a"
@ -4958,6 +5002,15 @@ stylelint-config-standard@^33.0.0:
dependencies: dependencies:
stylelint-config-recommended "^12.0.0" stylelint-config-recommended "^12.0.0"
stylelint-formatter-gitlab@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/stylelint-formatter-gitlab/-/stylelint-formatter-gitlab-1.0.2.tgz#56d3f68c1b3169ecddcdf039910b678bfd97ccd5"
integrity sha512-Iu5NjHSp/WdhUeICuUKNi6QvpEut5KPwnrx4XU5q1GZEcAvpyqbjBq7yMAEX6850BUza45ARpsfX4yfOcnFWLQ==
dependencies:
fs-extra "^8.1.0"
is-glob "^4.0.1"
js-yaml "^3.13.1"
stylelint-order@^6.0.3: stylelint-order@^6.0.3:
version "6.0.3" version "6.0.3"
resolved "https://registry.yarnpkg.com/stylelint-order/-/stylelint-order-6.0.3.tgz#160b78650bd90463241b992581efee7159baefc2" resolved "https://registry.yarnpkg.com/stylelint-order/-/stylelint-order-6.0.3.tgz#160b78650bd90463241b992581efee7159baefc2"
@ -5257,6 +5310,11 @@ unique-string@^2.0.0:
dependencies: dependencies:
crypto-random-string "^2.0.0" crypto-random-string "^2.0.0"
universalify@^0.1.0:
version "0.1.2"
resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66"
integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==
universalify@^0.2.0: universalify@^0.2.0:
version "0.2.0" version "0.2.0"
resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.2.0.tgz#6451760566fa857534745ab1dde952d1b1761be0" resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.2.0.tgz#6451760566fa857534745ab1dde952d1b1761be0"