Skip to content

Show PMD results in inline code quality diff

What does this MR do and why?

Show PMD results in inline code quality diff

Remove ./ from file when loading code quality data
If the file path in code quality data starts with ./
like files in the pmd scanner results do
remove it from the file path so that it gets displayed
in the code quality inline diff results

Changelog: fixed

References

Screenshots or screen recordings

Before After
Screenshot_2025-04-10_at_11.51.31
file paths in code quality data are exactly the paths from the report artifact, in this case with an initial ./
Screenshot_2025-04-10_at_11.51.55
file paths get their initial ./ trimmed off (if they have one) when we load code quality data
Screenshot_2025-04-10_at_11.50.39
results aren't displayed because the path doesn't match the path used in the diffs app 🐛
Screenshot_2025-04-10_at_11.48.51
results are displayed 🎉

How to set up and validate locally

  1. set up a project that shows code quality results from the PMD scanner, either:
    • set up a project to use the PMD CI/CD component and open an MR that adds a new code quality finding, or
    • clone this project that mocks the code quality scan and open an MR in it that adds a new mocked code quality finding:
      1. use this artifact as the feature-branch/gl-codequality-report.json
      2. in the MR, add .mvn/wrapper/MavenWrapperDownloader.java to the repo so that findings can be shown for it
      3. ensure pipelines ran for the base and head commits of the MR
  2. check that code quality findings are now displayed inline in the MR diff

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Miranda Fluharty

Merge request reports

Loading