From 05395c2fe8e9ffc7eb980e76228a022d6326f937 Mon Sep 17 00:00:00 2001
From: Peter Leitzen <pleitzen@gitlab.com>
Date: Mon, 26 Jun 2023 15:55:22 +0200
Subject: [PATCH] RuboCop TODO formatter: Retain all HAML exclusions

Previously, we only retained HAML exclusions which ended with
`html.haml.rb`. We also need to retain exclusions with different format
like `text`, `atom`, or no format (by mistake).
---
 rubocop/formatter/todo_formatter.rb           | 4 ++--
 spec/rubocop/formatter/todo_formatter_spec.rb | 4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/rubocop/formatter/todo_formatter.rb b/rubocop/formatter/todo_formatter.rb
index 912ce0da2cc73..9e20a95ba85ab 100644
--- a/rubocop/formatter/todo_formatter.rb
+++ b/rubocop/formatter/todo_formatter.rb
@@ -23,8 +23,8 @@ class TodoFormatter < BaseFormatter
       # with offenses.
       #
       # See https://gitlab.com/gitlab-org/gitlab/-/issues/415330#caveats
-      # on why the entry must end with `.html.haml.rb`.
-      RETAIN_EXCLUSIONS = %r{\.html\.haml\.rb$}
+      # on why the entry must end with `.haml.rb`.
+      RETAIN_EXCLUSIONS = %r{\.haml\.rb$}
 
       class << self
         attr_accessor :base_directory
diff --git a/spec/rubocop/formatter/todo_formatter_spec.rb b/spec/rubocop/formatter/todo_formatter_spec.rb
index fdd6117d0e6d9..55a641982895d 100644
--- a/spec/rubocop/formatter/todo_formatter_spec.rb
+++ b/spec/rubocop/formatter/todo_formatter_spec.rb
@@ -106,6 +106,8 @@ def run_formatter
             Exclude:
               - 'd.rb'
               - 'app/views/project.html.haml.rb'
+              - 'app/views/project.haml.rb'
+              - 'app/views/project.text.haml.rb'
               - 'app/views/unrelated.html.haml.rb.ext'
               - 'app/views/unrelated.html.haml.ext'
               - 'app/views/unrelated.html.haml'
@@ -122,7 +124,9 @@ def run_formatter
           B/TooManyOffenses:
             Exclude:
               - 'a.rb'
+              - 'app/views/project.haml.rb'
               - 'app/views/project.html.haml.rb'
+              - 'app/views/project.text.haml.rb'
               - 'c.rb'
         YAML
       end
-- 
GitLab