Class: Kamal::Lint::Result
- Inherits:
-
Struct
- Object
- Struct
- Kamal::Lint::Result
- Defined in:
- lib/kamal/lint/runner.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
Returns the value of attribute context.
-
#findings ⇒ Object
Returns the value of attribute findings.
-
#fixed ⇒ Object
Returns the value of attribute fixed.
Instance Method Summary collapse
- #empty? ⇒ Boolean
- #errors ⇒ Object
- #exit_code(fail_on: :error) ⇒ Object
- #infos ⇒ Object
- #warnings ⇒ Object
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context
5 6 7 |
# File 'lib/kamal/lint/runner.rb', line 5 def context @context end |
#findings ⇒ Object
Returns the value of attribute findings
5 6 7 |
# File 'lib/kamal/lint/runner.rb', line 5 def findings @findings end |
#fixed ⇒ Object
Returns the value of attribute fixed
5 6 7 |
# File 'lib/kamal/lint/runner.rb', line 5 def fixed @fixed end |
Instance Method Details
#empty? ⇒ Boolean
18 19 20 |
# File 'lib/kamal/lint/runner.rb', line 18 def empty? findings.empty? end |
#errors ⇒ Object
6 7 8 |
# File 'lib/kamal/lint/runner.rb', line 6 def errors findings.select { |f| f.severity == :error } end |
#exit_code(fail_on: :error) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/kamal/lint/runner.rb', line 22 def exit_code(fail_on: :error) threshold = SEVERITIES.index(fail_on.to_sym) worst = findings.map { |f| SEVERITIES.index(f.severity) }.compact.min return 0 if worst.nil? worst <= threshold ? 1 : 0 end |
#infos ⇒ Object
14 15 16 |
# File 'lib/kamal/lint/runner.rb', line 14 def infos findings.select { |f| f.severity == :info } end |
#warnings ⇒ Object
10 11 12 |
# File 'lib/kamal/lint/runner.rb', line 10 def warnings findings.select { |f| f.severity == :warning } end |