Code Quality reports all finding each time

gitlab self-hosted free
version: 15.8

I’ve enable Code-Quality on our bigger repository and while it works , all findings are reported in all MR instead of displaying only the differences compared with the previous code-quality scan.


# .gitlab-ci.yml
│ - template: Code-Quality.gitlab-ci.yml                                              
│ cache: []                                                                           
│ rules:                                                                              
│ │ - if: $CODE_QUALITY_DISABLED                                                      
│ │ │ when: never                                                                     
│ │ - if: $CI_PIPELINE_SOURCE == "merge_request_event" # Run code quality job in merge request pipelines

Do you have some guidance ? I did not find such issue reported in the documentation.


It seems that you customized the rules for the code_quality job. Does the target branch in the MR(s) have a recent pipeline that ran the code quality report?

From the Merge request widget docs (emphasis mine):

Code Quality analysis results display in the merge request widget area if a report from the target branch is available for comparison.

If you rules prevent the code quality job from running on the target branch - usually the default branch - then the MR widget doesn’t have anything to compare to, and shows the full report every time.

Hi @thiagocsf

thanks for answering me and spotting the potential issue, and the information I did not saw.
The default rules was not working, but the job ran after modifying this way (as described in the doc)

      when: never
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - if: $CI_COMMIT_TAG

Thanks for the help

1 Like