Commit fdf4b090 authored by Doug Stull's avatar Doug Stull

Merge branch 'pl-rubocop-todo-class' into 'master'

Make RuboCop's TodoFormatter entry a class not a struct

See merge request gitlab-org/gitlab!82595
parents f5f0f099 ba3ba743
...@@ -21,16 +21,19 @@ module RuboCop ...@@ -21,16 +21,19 @@ module RuboCop
# via `Enabled: false` in .rubocop_todo.yml or .rubocop_todo/. # via `Enabled: false` in .rubocop_todo.yml or .rubocop_todo/.
MAX_OFFENSE_COUNT = 15 MAX_OFFENSE_COUNT = 15
Todo = Struct.new(:cop_name, :files, :offense_count) do class Todo
def initialize(cop_name) attr_reader :cop_name, :files, :offense_count
super(cop_name, Set.new, 0)
def initialize(cop_name)
@cop_name = cop_name
@files = Set.new
@offense_count = 0
@cop_class = RuboCop::Cop::Registry.global.find_by_cop_name(cop_name) @cop_class = RuboCop::Cop::Registry.global.find_by_cop_name(cop_name)
end end
def record(file, offense_count) def record(file, offense_count)
files << file @files << file
self.offense_count += offense_count @offense_count += offense_count
end end
def autocorrectable? def autocorrectable?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment