Sort code quality violations in MR widget by severity
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.
In the merge request widget for code quality, there is a lot of item duplication. There is no information hierarchy or typography differences.
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.
- 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.
- Introduce severity types in CodequalityReports
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