Skip to content
GitLab
Next
    • Why GitLab
    • Pricing
    • Contact Sales
    • Explore
  • Why GitLab
  • Pricing
  • Contact Sales
  • Explore
  • Sign in
  • Get free trial
  • GitLab.orgGitLab.org
  • GitLabGitLab
  • Issues
  • #301121

Sort code quality violations in MR widget by severity

This is an actionable insight from the UX Department: MRs experience async critique research (insight).

Release Notes

When you have set up a project to run a Code Quality Scan it can find dozens to thousands of violations depending on the project. It is hard to find the most critical issues of those to address, even in the smaller view of the Merge Request Widget.

The Code Quality Merge Request Widget and the Full Report now sort Code Quality violations by Severity. This allows you to quickly see the most important code quality violations that need addressed in the Merge Request Widget or the project overall in the Full Code Quality report.

What

In the merge request widget for code quality, there is a lot of item duplication. There is no information hierarchy or typography differences.

image

Why

With so much duplicated content, it's difficult to focus on what makes each issue different. It also makes it hard to ignore a specific group of similar/identical issues.

How

  • New Code Quality violations should be sorted by severity descending (Highest to lowest - Blocker, critical, major, minor, info)
  • Resolved code quality violations can be sorted the same way and at the bottom of the list.

Proposal

  1. Introduce severity types in CodequalityReports
  2. Add sorted! method in CodequalityReports
  3. Call sorted! when generating the comparison between base and head in CodequalityReportsComparer
SEVERITY_TYPES = %w(blocker critical major minor info).freeze

def sorted!
  sort_by_severity!
  self
end

def sort_by_severity!
  @degradations = @degradations.sort_by do |_fingerprint, degradation|
    SEVERITY_TYPES.index(degradation.dig(:severity))
  end.to_h
end
Edited Mar 24, 2021 by James Heimbuck
Assignee
Assign to
Time tracking