Class: Kamal::Lint::Formatters::Github
- Inherits:
-
Object
- Object
- Kamal::Lint::Formatters::Github
- Defined in:
- lib/kamal/lint/formatters/github.rb
Overview
GitHub Actions workflow command output. See: docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions
Constant Summary collapse
- LEVEL =
{ error: "error", warning: "warning", info: "notice" }.freeze
Instance Method Summary collapse
-
#initialize(io: $stdout) ⇒ Github
constructor
A new instance of Github.
- #render(result) ⇒ Object
- #render_fix_summary(result) ⇒ Object
Constructor Details
#initialize(io: $stdout) ⇒ Github
Returns a new instance of Github.
15 16 17 |
# File 'lib/kamal/lint/formatters/github.rb', line 15 def initialize(io: $stdout) @io = io end |
Instance Method Details
#render(result) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/kamal/lint/formatters/github.rb', line 19 def render(result) result.findings.each do |finding| level = LEVEL[finding.severity] || "notice" attrs = { file: finding.file, line: finding.line, col: finding.column, title: "kamal-lint: #{finding.check_id}" }.compact attr_str = attrs.map { |k, v| "#{k}=#{escape_property(v.to_s)}" }.join(",") = (finding.) @io.puts "::#{level} #{attr_str}::#{}" end end |
#render_fix_summary(result) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/kamal/lint/formatters/github.rb', line 35 def render_fix_summary(result) return if result.fixed.empty? result.fixed.each do |finding| @io.puts "::notice file=#{finding.file},title=kamal-lint autofix::Fixed #{finding.check_id}" end end |