Class: RubocopGithubAnnotationFormatter::AnnotationFormatter

Inherits:
RuboCop::Formatter::BaseFormatter
  • Object
show all
Defined in:
lib/rubocop-github-annotation-formatter.rb

Constant Summary collapse

ANNOTATION_TEMPLATE =
"\n::error file=%<file>s,line=%<line>d,col=%<col>d :: %<message>s\n"

Instance Method Summary collapse

Instance Method Details

#file_finished(file, offenses) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/rubocop-github-annotation-formatter.rb', line 10

def file_finished(file, offenses)
  return if offenses.empty?

  offenses.each do |offense|
    next if offense.corrected?

    output.printf(ANNOTATION_TEMPLATE, file: file,  line: offense.location.line, col: offense.location.begin_pos,
      message: offense.message)
  end
end