Skip to content

RuboCop: Investigate silenced offenses for Lint/RedundantCopDisableDirective

Problem

In !99217 (merged) we've enabled Lint/RedundantCopDisableDirective in "grace period".

This caused rake rubocop:check:graceful to silences offenses like https://gitlab.com/gitlab-org/gitlab/-/jobs/3115984225

Proposed solution

Investigate silenced offenses and re-enable this rule again in "grace period".

Make sure that bundle exec rake rubocop:check:graceful passes.

Implementation Guide

  1. Enable Lint/RedundantCopDisableDirective by removing Enabled: false (plus comments above) in .rubocop_todo/lint/redundant_cop_disable_directive.yml.

  2. Enable "grace period" permanently in .rubocop.yml by adding

Lint/RedundantCopDisableDirective:
  # Permanent "grace period" to silence new offenses on CI
  # See https://gitlab.com/gitlab-org/gitlab/-/issues/376133
  Details: grace period
  1. Autocorrect all offenses (will be Lint/RedundantCopDisableDirective only) via
bundle exec rubocop --parallel --autocorrect-all
# Takes a long time
  1. Drop autocorrects for cops other than Lint/RedundantCopDisableDirective (if any)

  2. Create an MR

Edited by Peter Leitzen