cfn-nag 0.3.29 → 0.3.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cfn-nag/violation.rb +27 -24
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7144cb5b2b3d13133235f4005a1fac1de6451b5a
4
- data.tar.gz: fa086c99e462871db43246722da212b7125a7128
3
+ metadata.gz: 59441006b3494befe307a988a3150c7a06703f0e
4
+ data.tar.gz: 18e6b6b11833b57d0df2dd39e0d775bc75e4aaae
5
5
  SHA512:
6
- metadata.gz: 9d4c65a97de5b446e6d40a420feb53abcc24d8816466797e9c26ae38f23c8f640e24bcf35a18aa624e1cd6db687d81a92aa049399ea9f093724e749584989fcf
7
- data.tar.gz: be5f36b7874684b163ff7f97f588aa514c2be9e0ce5d86e5155c7df5805f647e802cad07b2cc88f0c42402cb757d7e8568a973b50bbf02a47086869e28409ef3
6
+ metadata.gz: 8b35ab8943567fb61efbf17d343d94a5be75c09872f617427d18f47a3e88b1b8bb412ece9decf5e846d8cd9d9477f043670221d2dfec7c8e820b6c9a4509ad8e
7
+ data.tar.gz: 8e96a3dd3f4a9ecbde34fc26375e3b1606be038b97bc46711e26e3f305404e51df1c408713aa2a59e5086f7815d1913ff5a784e370fdea99163ee9b91e2edeac
@@ -1,5 +1,6 @@
1
1
  require_relative 'rule_definition'
2
2
 
3
+ # Rule definition for violations
3
4
  class Violation < RuleDefinition
4
5
  attr_reader :logical_resource_ids
5
6
 
@@ -15,7 +16,7 @@ class Violation < RuleDefinition
15
16
  end
16
17
 
17
18
  def to_s
18
- "#{super.to_s} #{@logical_resource_ids}"
19
+ "#{super} #{@logical_resource_ids}"
19
20
  end
20
21
 
21
22
  def to_h
@@ -24,35 +25,37 @@ class Violation < RuleDefinition
24
25
  )
25
26
  end
26
27
 
27
- def self.count_warnings(violations)
28
- violations.inject(0) do |count, violation|
29
- if violation.type == Violation::WARNING
30
- count += if empty?(violation.logical_resource_ids)
31
- 1
32
- else
33
- violation.logical_resource_ids.size
34
- end
28
+ class << self
29
+ def count_warnings(violations)
30
+ violations.inject(0) do |count, violation|
31
+ if violation.type == Violation::WARNING
32
+ count += if empty?(violation.logical_resource_ids)
33
+ 1
34
+ else
35
+ violation.logical_resource_ids.size
36
+ end
37
+ end
38
+ count
35
39
  end
36
- count
37
40
  end
38
- end
39
41
 
40
- def self.count_failures(violations)
41
- violations.inject(0) do |count, violation|
42
- if violation.type == Violation::FAILING_VIOLATION
43
- count += if empty?(violation.logical_resource_ids)
44
- 1
45
- else
46
- violation.logical_resource_ids.size
47
- end
42
+ def count_failures(violations)
43
+ violations.inject(0) do |count, violation|
44
+ if violation.type == Violation::FAILING_VIOLATION
45
+ count += if empty?(violation.logical_resource_ids)
46
+ 1
47
+ else
48
+ violation.logical_resource_ids.size
49
+ end
50
+ end
51
+ count
48
52
  end
49
- count
50
53
  end
51
- end
52
54
 
53
- private
55
+ private
54
56
 
55
- def self.empty?(array)
56
- array.nil? || array.empty?
57
+ def empty?(array)
58
+ array.nil? || array.empty?
59
+ end
57
60
  end
58
61
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cfn-nag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.29
4
+ version: 0.3.30
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Kascic
@@ -179,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
179
179
  version: '0'
180
180
  requirements: []
181
181
  rubyforge_project:
182
- rubygems_version: 2.6.3
182
+ rubygems_version: 2.6.14
183
183
  signing_key:
184
184
  specification_version: 4
185
185
  summary: cfn-nag