Class: PuppetLint::Report::GitHubActionsReporter

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet-lint/report/github.rb

Overview

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

Constant Summary collapse

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

Class Method Summary collapse

Class Method Details

.format_problem(file, problem) ⇒ Object



10
11
12
# File 'lib/puppet-lint/report/github.rb', line 10

def self.format_problem(file, problem)
  "\n::#{problem[:kind]} file=#{file},line=#{problem[:line]},col=#{problem[:column]}::#{github_escape(problem[:message])} (check: #{problem[:check]})\n"
end

.github_escape(string) ⇒ Object



14
15
16
# File 'lib/puppet-lint/report/github.rb', line 14

def self.github_escape(string)
  string.gsub(Regexp.union(ESCAPE_MAP.keys), ESCAPE_MAP)
end