Class: Kamal::Lint::Runner

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

Instance Method Summary collapse

Constructor Details

#initialize(config_file:, destination: nil, kamal_version: nil, registry: Lint.registry, fix: false, include_kamal_errors: false) ⇒ Runner

Returns a new instance of Runner.



32
33
34
35
36
37
38
39
40
# File 'lib/kamal/lint/runner.rb', line 32

def initialize(config_file:, destination: nil, kamal_version: nil,
  registry: Lint.registry, fix: false, include_kamal_errors: false)
  @config_file = config_file
  @destination = destination
  @kamal_version_override = kamal_version
  @registry = registry
  @fix = fix
  @include_kamal_errors = include_kamal_errors
end

Instance Method Details

#callObject



42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/kamal/lint/runner.rb', line 42

def call
  context = load_context
  findings = collect_findings(context)

  fixed = @fix ? apply_autofixes(findings, context) : []

  if @fix && !fixed.empty?
    context = load_context
    findings = collect_findings(context)
  end

  Result.new(findings: findings, context: context, fixed: fixed)
end