Class: Kamal::Lint::Result

Inherits:
Struct
  • Object
show all
Defined in:
lib/kamal/lint/runner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#contextObject

Returns the value of attribute context

Returns:

  • (Object)

    the current value of context



5
6
7
# File 'lib/kamal/lint/runner.rb', line 5

def context
  @context
end

#findingsObject

Returns the value of attribute findings

Returns:

  • (Object)

    the current value of findings



5
6
7
# File 'lib/kamal/lint/runner.rb', line 5

def findings
  @findings
end

#fixedObject

Returns the value of attribute fixed

Returns:

  • (Object)

    the current value of fixed



5
6
7
# File 'lib/kamal/lint/runner.rb', line 5

def fixed
  @fixed
end

Instance Method Details

#empty?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/kamal/lint/runner.rb', line 18

def empty?
  findings.empty?
end

#errorsObject



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

#infosObject



14
15
16
# File 'lib/kamal/lint/runner.rb', line 14

def infos
  findings.select { |f| f.severity == :info }
end

#warningsObject



10
11
12
# File 'lib/kamal/lint/runner.rb', line 10

def warnings
  findings.select { |f| f.severity == :warning }
end