Class: Kamal::Lint::Check
- Inherits:
-
Object
- Object
- Kamal::Lint::Check
show all
- Defined in:
- lib/kamal/lint/check.rb
Overview
Base class for all checks.
Subclasses declare their identity and applicable Kamal version range with the DSL methods below and implement ‘#call(context)` returning an Array of Findings (possibly empty).
Direct Known Subclasses
Kamal::Lint::Checks::AccessoryImageLatest, Kamal::Lint::Checks::AccessoryPlacementMissing, Kamal::Lint::Checks::AccessoryRoleUndefined, Kamal::Lint::Checks::BootLimitExceedsHosts, Kamal::Lint::Checks::BuilderRegistrySecretUndeclared, Kamal::Lint::Checks::EmptyWebRole, Kamal::Lint::Checks::ImageRegistryMismatch, Kamal::Lint::Checks::KamalSecretsNotGitignored, Kamal::Lint::Checks::MissingProxyHealthcheck, Kamal::Lint::Checks::MissingServiceName, Kamal::Lint::Checks::RegistryWithoutExplicitServer, Kamal::Lint::Checks::RoleHostsEmpty, Kamal::Lint::Checks::SecretInEnvClear, Kamal::Lint::Checks::SecretNotDeclared, Kamal::Lint::Checks::SslWithoutHost, Kamal::Lint::Checks::TraefikLegacyKeys
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(context) ⇒ Check
Returns a new instance of Check.
57
58
59
|
# File 'lib/kamal/lint/check.rb', line 57
def initialize(context)
@context = context
end
|
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
61
62
63
|
# File 'lib/kamal/lint/check.rb', line 61
def context
@context
end
|
Class Method Details
.applies_to?(kamal_version) ⇒ Boolean
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/kamal/lint/check.rb', line 43
def applies_to?(kamal_version)
return true if kamal_version.nil?
if @since && Gem::Version.new(kamal_version) < Gem::Version.new(@since)
return false
end
if @until_version && Gem::Version.new(kamal_version) >= Gem::Version.new(@until_version)
return false
end
true
end
|
.autofixable(value = nil) ⇒ Object
Mark this check as autofix-capable in the registry listing.
38
39
40
41
|
# File 'lib/kamal/lint/check.rb', line 38
def autofixable(value = nil)
@autofixable = value unless value.nil?
@autofixable || false
end
|
.id(value = nil) ⇒ Object
12
13
14
15
|
# File 'lib/kamal/lint/check.rb', line 12
def id(value = nil)
@id = value if value
@id
end
|
.severity(value = nil) ⇒ Object
17
18
19
20
|
# File 'lib/kamal/lint/check.rb', line 17
def severity(value = nil)
@severity = value if value
@severity || :warning
end
|
.since(value = nil) ⇒ Object
27
28
29
30
|
# File 'lib/kamal/lint/check.rb', line 27
def since(value = nil)
@since = value if value
@since
end
|
.title(value = nil) ⇒ Object
22
23
24
25
|
# File 'lib/kamal/lint/check.rb', line 22
def title(value = nil)
@title = value if value
@title
end
|
.until_version(value = nil) ⇒ Object
32
33
34
35
|
# File 'lib/kamal/lint/check.rb', line 32
def until_version(value = nil)
@until_version = value if value
@until_version
end
|
Instance Method Details
#call ⇒ Object
63
64
65
|
# File 'lib/kamal/lint/check.rb', line 63
def call
raise NotImplementedError
end
|