Skip to content

Reduce duplicate button findings

Mark Florian requested to merge fix-button-false-positives into main

Ignore button component files in class rule

It doesn't make sense to look for "private" classes in the component that implements the design system.

This removes a single finding: https://gitlab.com/gitlab-org/gitlab/-/blob/aab3d381da92892252a2fb85794e403e0022a5c6/app/components/pajamas/button_component.rb#L57

Ignore gl-button-* modifier classes

These will usually be accompanied by the gl-button class itself. This means we were over counting the number of non-compliant buttons.

Use of the gl-button-icon class is a code smell. In this case, it's used for rendering a custom image rather than a standard SVG icon, which the Pajamas::ButtonComponent does not support.

This results in 28 fewer findings against gitlab-org/gitlab@aab3d381. These findings can be seen before this change with this filter:

check_id ew "button-class-haml-rb" and extra.lines co "gl-button-"

Addresses #76 (closed) and gitlab-org/gitlab#417792 (comment 1467315342).

Screenshots

Before After
Screenshot_2023-07-13_at_10-54-15_Pajamas_Adoption_Scanner_Dashboard Screenshot_2023-07-13_at_10-54-19_Pajamas_Adoption_Scanner_Dashboard
Screenshot_2023-07-13_at_10-53-46_Pajamas_Adoption_Scanner_Dashboard Screenshot_2023-07-13_at_10-53-53_Pajamas_Adoption_Scanner_Dashboard

Review/run this locally

  1. Copy the pages in mr job URL (must have succeeded)
  2. Run bin/review-mr.sh <job url>
Edited by Mark Florian

Merge request reports

Loading