Class: Kamal::Lint::Checks::AccessoryRoleUndefined
- Inherits:
-
Kamal::Lint::Check
- Object
- Kamal::Lint::Check
- Kamal::Lint::Checks::AccessoryRoleUndefined
- Defined in:
- lib/kamal/lint/checks/accessory_role_undefined.rb
Instance Attribute Summary
Attributes inherited from Kamal::Lint::Check
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
#call ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/kamal/lint/checks/accessory_role_undefined.rb', line 12 def call findings = [] accessories = parsed["accessories"] return findings unless accessories.is_a?(Hash) defined_roles = ServersHelper.role_names(parsed["servers"]) accessories.each do |name, accessory| next unless accessory.is_a?(Hash) roles = accessory["roles"] next unless roles.is_a?(Array) roles.each_with_index do |role, idx| next unless role.is_a?(String) next if defined_roles.include?(role) findings << finding( message: "accessory `#{name}` references role `#{role}` which is not defined under `servers`", line: context.line_for([ "accessories", name, "roles", idx.to_s ]) ) end end findings end |