mirror of
https://github.com/inspec/inspec
synced 2024-11-27 15:10:44 +00:00
Merge pull request #332 from chef/dr/check-non-controls
ignore auto-generated controls during verify check
This commit is contained in:
commit
f70c6acb8f
3 changed files with 4 additions and 3 deletions
|
@ -105,6 +105,7 @@ module Inspec
|
|||
@params[:rules].each do |group, rules_array|
|
||||
@logger.debug "Verify all rules in #{group}"
|
||||
rules_array.each do |id, rule|
|
||||
next if id.start_with? '(generated '
|
||||
error.call('Avoid rules with empty IDs') if id.nil? or id.empty?
|
||||
warn.call("Rule #{id} has no title") if rule[:title].to_s.empty?
|
||||
warn.call("Rule #{id} has no description") if rule[:desc].to_s.empty?
|
||||
|
|
|
@ -111,7 +111,7 @@ module Inspec
|
|||
define_method :describe do |*args, &block|
|
||||
path = block.source_location[0]
|
||||
line = block.source_location[1]
|
||||
id = "#{File.basename(path)}:#{line} #{SecureRandom.hex}"
|
||||
id = "(generated from #{File.basename(path)}:#{line} #{SecureRandom.hex})"
|
||||
rule = rule_class.new(id, {}) do
|
||||
describe(*args, &block)
|
||||
end
|
||||
|
|
|
@ -34,7 +34,7 @@ describe Inspec::ProfileContext do
|
|||
load('describe true do; it { should_eq true }; end')
|
||||
.must_output ''
|
||||
profile.rules.keys.length.must_equal 1
|
||||
profile.rules.keys[0].must_match /^unknown:1 [0-9a-f]+$/
|
||||
profile.rules.keys[0].must_match /^\(generated from unknown:1 [0-9a-f]+\)$/
|
||||
profile.rules.values[0].must_be_kind_of Inspec::Rule
|
||||
end
|
||||
|
||||
|
@ -43,7 +43,7 @@ describe Inspec::ProfileContext do
|
|||
.must_output ''
|
||||
profile.rules.keys.length.must_equal 3
|
||||
[0, 1, 2].each do |i|
|
||||
profile.rules.keys[i].must_match /^unknown:2 [0-9a-f]+$/
|
||||
profile.rules.keys[i].must_match /^\(generated from unknown:2 [0-9a-f]+\)$/
|
||||
profile.rules.values[i].must_be_kind_of Inspec::Rule
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue