Class: RuboCop::Formatter::GitHubActionsFormatter Private

Inherits:
BaseFormatter
  • Object
show all
Defined in:
lib/rubocop/formatter/git_hub_actions_formatter.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

This formatter formats report data as GitHub Workflow commands resulting in GitHub check annotations when run within GitHub Actions.

Constant Summary collapse

ESCAPE_MAP =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

{ '%' => '%25', "\n" => '%0A', "\r" => '%0D' }.freeze

Instance Attribute Summary

Attributes inherited from BaseFormatter

#options, #output

Instance Method Summary collapse

Methods inherited from BaseFormatter

#file_started, #initialize

Constructor Details

This class inherits a constructor from RuboCop::Formatter::BaseFormatter

Instance Method Details

#file_finished(file, offenses) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



14
15
16
# File 'lib/rubocop/formatter/git_hub_actions_formatter.rb', line 14

def file_finished(file, offenses)
  @offenses_for_files[file] = offenses unless offenses.empty?
end

#finished(_inspected_files) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



18
19
20
21
22
23
24
25
# File 'lib/rubocop/formatter/git_hub_actions_formatter.rb', line 18

def finished(_inspected_files)
  @offenses_for_files.each do |file, offenses|
    offenses.each do |offense|
      report_offense(file, offense)
    end
  end
  output.puts
end

#started(_target_files) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



10
11
12
# File 'lib/rubocop/formatter/git_hub_actions_formatter.rb', line 10

def started(_target_files)
  @offenses_for_files = {}
end