Skip to content

Conversation

@BackEndTea
Copy link
Contributor

Gitlab CI wasn't being detected by the CiDetectedErrorFormatter. This MR allows detection so that the CiDetectedErrorFormatter can be used for gitlab as well.

@ondrejmirtes
Copy link
Member

AFAIK GitLab still only shows these results in paid tiers: https://docs.gitlab.com/ee/ci/testing/code_quality.html

That's why GitLab CI is not currently detected by default. Maybe it's part of GITLAB_FEATURES env variable, I'm not sure. If you research that and detect correctly then I'd merge that.

@alexbrouwer
Copy link

alexbrouwer commented Dec 18, 2025

Gitlab expects the results in a JSON file which can the be passed as a "codequality" artifact. It will automatically be parsed and displayed. Where depends on the "tier" being used, but even the free version shows it as you can read here.

Currently I have to run the PHPStan analysis twice. Once the get results in a Gitlab format, once to get it in a human readable form.

phpstan: # ... script: - vendor/bin/phpstan analyse --no-progress --error-format=gitlab --memory-limit=2G --quiet > code_quality_phpstan.json || echo "PHPStan found errors, see below." - vendor/bin/phpstan analyse --no-progress --memory-limit=2G artifacts: reports: codequality: code_quality_phpstan.json

Automatically detecting Gitlab resolves the duplicate analysis, but would require choosing, or adding config for, the name of the output file.

@BackEndTea
Copy link
Contributor Author

@alexbrouwer i created https://github.com/BackEndTea/phpstan-multiple-error-formatter this package to have multiple error formatters at once for my case. Perhaps it could work for you as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants