Class: HamlLint::OffenseCollector

Inherits:
RuboCop::Formatter::BaseFormatter
  • Object
show all
Defined in:
lib/haml_lint/linter/rubocop.rb

Overview

Collects offenses detected by RuboCop.

Class Attribute Summary collapse

Instance Method Summary collapse

Class Attribute Details

.offensesObject

List of offenses reported by RuboCop.



130
131
132
# File 'lib/haml_lint/linter/rubocop.rb', line 130

def offenses
  @offenses
end

Instance Method Details

#file_finished(_file, offenses) ⇒ Object

Executed when a file has been scanned by RuboCop, adding the reported offenses to our collection.

Parameters:

  • _file (String)
  • offenses (Array<RuboCop::Cop::Offense>)


145
146
147
# File 'lib/haml_lint/linter/rubocop.rb', line 145

def file_finished(_file, offenses)
  self.class.offenses += offenses
end

#started(_target_files) ⇒ Object

Executed when RuboCop begins linting.

Parameters:

  • _target_files (Array<String>)


136
137
138
# File 'lib/haml_lint/linter/rubocop.rb', line 136

def started(_target_files)
  self.class.offenses = []
end