Method: Inspec::InspecCLI#check
- Defined in:
- lib/inspec/cli.rb
#check(path) ⇒ Object
rubocop:disable Metrics/AbcSize
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/inspec/cli.rb', line 48 def check(path) # rubocop:disable Metrics/AbcSize diagnose o = opts.dup # configure_logger(o) # we do not need a logger for check yet o[:ignore_supports] = true # we check for integrity only # run check profile = Inspec::Profile.for_target(path, o) result = profile.check if opts['format'] == 'json' puts JSON.generate(result) else headline('Summary') %w{location profile controls timestamp valid}.each { |item| puts "#{mark_text(item.to_s.capitalize + ':')} #{result[:summary][item.to_sym]}" } puts %w{errors warnings}.each { |list| headline(list.to_s.capitalize) result[list.to_sym].each { |item| puts "#{item[:file]}:#{item[:line]}:#{item[:column]}: #{item[:msg]} " } puts } end exit 1 unless result[:summary][:valid] end |