Skip to content

Commit

Permalink
#222 testing intergation with SAR pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
erickascic committed Jan 23, 2020
1 parent 76b8471 commit 3507dbd
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions lib/cfn-nag/base_rule.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# frozen_string_literal: true

require 'cfn-nag/violation'

# Base class all Rules should subclass
class CfnNag
class BaseRule
##
# Returns a collection of logical resource ids
#
def audit_impl(_cfn_model)
raise 'must implement in subclass'
end

##
# Returns nil when there are no violations
# Returns a Violation object otherwise
#
def audit(cfn_model)
logical_resource_ids = audit_impl(cfn_model)
return if logical_resource_ids.empty?

Violation.new(id: rule_id,
type: rule_type,
message: rule_text,
logical_resource_ids: logical_resource_ids)
end
end
end

0 comments on commit 3507dbd

Please sign in to comment.