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.
- checksums.yaml +4 -4
- data/lib/cfn-nag/violation.rb +27 -24
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59441006b3494befe307a988a3150c7a06703f0e
|
4
|
+
data.tar.gz: 18e6b6b11833b57d0df2dd39e0d775bc75e4aaae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b35ab8943567fb61efbf17d343d94a5be75c09872f617427d18f47a3e88b1b8bb412ece9decf5e846d8cd9d9477f043670221d2dfec7c8e820b6c9a4509ad8e
|
7
|
+
data.tar.gz: 8e96a3dd3f4a9ecbde34fc26375e3b1606be038b97bc46711e26e3f305404e51df1c408713aa2a59e5086f7815d1913ff5a784e370fdea99163ee9b91e2edeac
|
data/lib/cfn-nag/violation.rb
CHANGED
@@ -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
|
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
|
-
|
28
|
-
violations
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
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
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
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
|
-
|
55
|
+
private
|
54
56
|
|
55
|
-
|
56
|
-
|
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.
|
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.
|
182
|
+
rubygems_version: 2.6.14
|
183
183
|
signing_key:
|
184
184
|
specification_version: 4
|
185
185
|
summary: cfn-nag
|