puppet-lint-resource_reference_syntax 1.0.9 → 1.0.10
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/puppet-lint/plugins/resource_reference_without_title_capital.rb +8 -2
- data/lib/puppet-lint/plugins/resource_reference_without_whitespace.rb +1 -1
- data/spec/puppet-lint/plugins/resource_reference_without_title_capital_spec.rb +9 -1
- data/spec/puppet-lint/plugins/resource_reference_without_whitespace_spec.rb +8 -0
- 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: cf65ebeb1562c96b729170887f3f0858aa334167
|
4
|
+
data.tar.gz: f958ba6c54fad7dfc3d0729159156b2721c752d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61d6d864fdabfdc16324549676577a45a83a9e34956f629d9eb6d1f347c1f0ac1a96e4ee84604131c05536ab87948ff0ddfaeed90aa13a4cc3aace9bd71d97e8
|
7
|
+
data.tar.gz: 1a649de579bedca54c45dbaa496e482c2ca4fa37d128879d45dced05f0eeff7f79f7307fb371cf11d550c87c269046068c01e93affe318730be4d4caa3240039
|
@@ -6,18 +6,24 @@ PuppetLint.new_check(:resource_reference_without_title_capital) do
|
|
6
6
|
}.each do |param_token|
|
7
7
|
value_token = param_token.next_code_token
|
8
8
|
check = value_token.next_token
|
9
|
-
until check.nil?
|
9
|
+
until resource[:param_tokens].include? check or not resource[:tokens].include? check or check.nil?
|
10
10
|
case value_token.next_token.type
|
11
11
|
when :CLASSREF
|
12
12
|
begin
|
13
13
|
if value_token.next_token.next_token.type == :LBRACK
|
14
14
|
check_token = value_token.next_token.next_token.next_token
|
15
|
-
if check_token.type == :CLASSREF
|
15
|
+
if check_token.type == :CLASSREF
|
16
16
|
notify :error, {
|
17
17
|
:message => 'resource reference with title with capital letter',
|
18
18
|
:line => check_token.line,
|
19
19
|
:column => check_token.column
|
20
20
|
}
|
21
|
+
elsif check_token.type == :NAME
|
22
|
+
notify :error, {
|
23
|
+
:message => 'resource reference with title with missing quotes',
|
24
|
+
:line => check_token.line,
|
25
|
+
:column => check_token.column
|
26
|
+
}
|
21
27
|
end
|
22
28
|
end
|
23
29
|
value_token = value_token.next_token
|
@@ -6,7 +6,7 @@ PuppetLint.new_check(:resource_reference_without_whitespace) do
|
|
6
6
|
}.each do |param_token|
|
7
7
|
value_token = param_token.next_code_token
|
8
8
|
check = value_token.next_token
|
9
|
-
until check.nil?
|
9
|
+
until resource[:param_tokens].include? check or not resource[:tokens].include? check or check.nil?
|
10
10
|
case value_token.next_token.type
|
11
11
|
when :CLASSREF
|
12
12
|
begin
|
@@ -100,7 +100,7 @@ describe 'resource_reference_without_title_capital' do
|
|
100
100
|
end
|
101
101
|
|
102
102
|
context 'resource reference with title without quotes' do
|
103
|
-
let(:msg) { 'resource reference with title with
|
103
|
+
let(:msg) { 'resource reference with title with missing quotes' }
|
104
104
|
let(:code) { "file { 'foo': ensure => file, notify => Title[one],}" }
|
105
105
|
|
106
106
|
it 'should only detect a single problem' do
|
@@ -112,4 +112,12 @@ describe 'resource_reference_without_title_capital' do
|
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
115
|
+
context 'stay within the parameter context' do
|
116
|
+
let(:code) { "file { 'foo': ensure => file, notify => Title['One'],} $var = [ Exec[runsomething] ]" }
|
117
|
+
|
118
|
+
it 'should detect no problem' do
|
119
|
+
expect(problems).to have(0).problem
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
115
123
|
end
|
@@ -55,4 +55,12 @@ describe 'resource_reference_without_whitespace' do
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
+
context 'stay within the parameter context' do
|
59
|
+
let(:code) { "package { 'bar': ensure => installed,} exec { 'baz': require => Package['bar'],} File { 'foo': ensure => file,}" }
|
60
|
+
|
61
|
+
it 'should detect no problem' do
|
62
|
+
expect(problems).to have(0).problem
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
58
66
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet-lint-resource_reference_syntax
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Alfke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: puppet-lint
|