Integrate codequality reports into Gitlab

Created on 14 September 2023, over 1 year ago
Updated 13 December 2023, about 1 year ago

Problem/Motivation

Now that Gitlab is running for core its time to clean up how codequality is reported. Currently all code quality steps like esling, phpcs, phpstan, stylelint all al reported as "tests". Which is technically true, but its also possible to output those reports and have them reported in a separate tab. This would also allow showing the problems inline in the merge requests.

See: https://docs.gitlab.com/ee/ci/testing/code_quality.html#implement-a-cust...

Known issues.
We have Gitlab ultimate, so we COULD get inline errors in the mergerequests.

Unfortunately, it is only displayed on the child pipelines, this means no inline help on the MR... :disappointed: I was secretly already dreading if the child pipeline setup was going to make us run into some issues.
There is an open issue (for years) around this. But that doesnt seem to be close. We could have inline error messages in the pipeline, but not if we use childs. (https://gitlab.com/gitlab-org/gitlab/-/issues/215725).

Possible tools per lint step
The tools we use and how they could integrate into gitlab:

eslint

Add the flag --format gitlab

PHP Code Sniffer

No real support, but seems easy enough:
https://github.com/micheh/phpcs-gitlab or https://daniel-r-ness.medium.com/converting-phpcs-output-to-gitlab-codec...

PHPStan

phpstan analyze --error-format=gitlab

stylelint

https://github.com/leon0399/stylelint-formatter-gitlab

Dependency evaluation; all these are dev dependencies that do a single small task of converting tool output to a format GitLab can read, none of this is needed at runtime and will in effect only be executed on GitLab.

micheh/phpcs-gitlab

Release cycle: two releases in 2020, none since; both the plugin and the GitLab output format are stable and seemingly require no maintenance.

Security policy: none

Maintainer: Michel Hunziker https://github.com/micheh

eslint-formatter-gitlab

Release cycle: major releases approximately once a year, follows strict semver and updates when NodeJS is updated.

Security policy: none

Maintainer: Remco Haszing https://gitlab.com/remcohaszing

stylelint-formatter-gitlab

Release cycle: three releases in four years

Security policy: none

Maintainer: Leonid Meleshin https://gitlab.com/leon0399

Steps to reproduce

Run a pipeline, in the childpipeline there is a new Codequality tab. See draft MR for an mr with these changes and some real errors.

Proposed resolution

Add a few packages for the reports and export everything as codequality artifacts.

Remaining tasks

  1. Decide if the dependencies are ok like this

User interface changes

Tests tab in gitlab now only shows tests, new tab codequality with codequality issues.

API changes

Data model changes

Release notes snippet

Three new development dependencies provide GitLab-compatible output for PHP CodeSniffer, ESLint and Stylelint.

✨ Feature request
Status

Fixed

Version

10.2 ✨

Component
OtherΒ  β†’

Last updated 2 days ago

Created by

πŸ‡³πŸ‡±Netherlands bbrala Netherlands

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024