Skip to content

Show code quality badge on files in MR diff view

What does this MR do?

For #267612 (closed)

Show a badge in the file header of each file in the MR diff/changes tab that has code quality changes, i.e. if the MR affects the code quality of a given file, show a badge next to its filename in the diff view

Screen_Shot_2021-03-24_at_12.49.47

Technically, this MR:

  • adds inline_codequality as a licensed feature for GitLab Ultimate
  • is behind the codequality_mr_diff feature flag
  • outputs the code quality diff endpoint in haml to be consumed by the diffs vue app only if both the feature flag and the licensed feature are enabled/available
  • modifies the diffs vue app to fetch data from this endpoint if it is provided and display badges on changed files:
    • uses the same polling procedure as inline code coverage
    • stores the result in the diffs store as codequalityDiff
    • passes along code quality diff data for each file to diff_file.vue as codequalityDiff prop (defaults to [])
    • if a diff_file has codequalityDiff.length > 0, passes along hasCodequalityChanges prop to diff_file_header.vue
    • if a diff_file_header hasCodequalityChanges, display the code quality badge component
  • add the code quality badge component

Screenshots (strongly suggested)

Screen_Recording_2021-03-15_at_15.32.08

link-to-widget functionality has been split off from this MR and will be implemented in !57791 (merged)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Edited by Miranda Fluharty

Merge request reports