Class: Kamal::Lint::Checks::SecretNotDeclared

Inherits:
Kamal::Lint::Check show all
Defined in:
lib/kamal/lint/checks/secret_not_declared.rb

Instance Attribute Summary

Attributes inherited from Kamal::Lint::Check

#context

Instance Method Summary collapse

Methods inherited from Kamal::Lint::Check

applies_to?, autofixable, id, #initialize, severity, since, title, until_version

Constructor Details

This class inherits a constructor from Kamal::Lint::Check

Instance Method Details

#callObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/kamal/lint/checks/secret_not_declared.rb', line 12

def call
  findings = []
  declared = context.secrets

  referenced_secret_keys.each do |path, name|
    next if declared.include?(name)

    findings << finding(
      message: "env.secret references `#{name}` but it isn't declared in .kamal/secrets",
      line: context.line_for(path)
    )
  end

  findings
end