puppet-lint-resource_reference_syntax 1.0.6 → 1.0.7
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6444407fc868020ca8c63c1cc06bfeee0735f1e6
|
4
|
+
data.tar.gz: 6559535d01dfde23af4c912e969c3d8bad2421e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e25f233604d1f3870dcc7dfd3b34369e42e677d03ba153fc3e0ecbde4dff6c13a34481f137fee2a9e4687a315eb7af2e0387fb1a869c6d3af674719964a3ebc3
|
7
|
+
data.tar.gz: 65941825a27dae57fd9275c4dc0015c299a90cba98e01d922de705e512864321cddcd2b93ab0684367bf975ed2c27c68eb01df2b3b783e145fa6beeb5118b330
|
@@ -4,13 +4,26 @@ PuppetLint.new_check(:resource_reference_without_whitespace) do
|
|
4
4
|
resource[:param_tokens].select { |param_token|
|
5
5
|
['require', 'subscribe', 'notify', 'before', 'consume', 'export'].include? param_token.value
|
6
6
|
}.each do |param_token|
|
7
|
-
value_token = param_token.next_code_token
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
7
|
+
value_token = param_token.next_code_token
|
8
|
+
check = value_token.next_token
|
9
|
+
until check.nil?
|
10
|
+
case value_token.next_token.type
|
11
|
+
when :CLASSREF
|
12
|
+
begin
|
13
|
+
if value_token.next_token.next_token.type == :WHITESPACE
|
14
|
+
notify :error, {
|
15
|
+
:message => 'whitespce between reference type and title',
|
16
|
+
:line => param_token.next_code_token.next_code_token.line,
|
17
|
+
:column => param_token.next_code_token.next_code_token.column
|
18
|
+
}
|
19
|
+
end
|
20
|
+
value_token = value_token.next_token
|
21
|
+
check = value_token.next_token
|
22
|
+
end
|
23
|
+
else
|
24
|
+
value_token = value_token.next_token
|
25
|
+
check = value_token.next_token
|
26
|
+
end
|
14
27
|
end
|
15
28
|
end
|
16
29
|
end
|
@@ -35,6 +35,14 @@ describe 'resource_reference_without_title_capital' do
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
+
context 'multiple proper references as array one in quotes, one as variable' do
|
39
|
+
let(:code) { "file { 'foo': ensure => file, notify => [ Title['one'], Title[$foo_var] ],}" }
|
40
|
+
|
41
|
+
it 'should detect no problem' do
|
42
|
+
expect(problems).to have(0).problem
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
38
46
|
context 'a proper reference as variable' do
|
39
47
|
let(:code) { "file { 'foo': ensure => file, notify => Title[$foo_var],}" }
|
40
48
|
|
@@ -2,6 +2,24 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe 'resource_reference_without_whitespace' do
|
4
4
|
|
5
|
+
context 'a proper reference as array' do
|
6
|
+
let(:msg) { 'whitespce between reference type and title' }
|
7
|
+
let(:code) { "file { 'foo': ensure => file, notify => [ Title['one'], Title['two'] ]}" }
|
8
|
+
|
9
|
+
it 'should detect no problem' do
|
10
|
+
expect(problems).to have(0).problem
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
context 'a proper reference as array one fix, one variable' do
|
15
|
+
let(:msg) { 'whitespce between reference type and title' }
|
16
|
+
let(:code) { "file { 'foo': ensure => file, notify => [ Title['one'], Title[$two] ]}" }
|
17
|
+
|
18
|
+
it 'should detect no problem' do
|
19
|
+
expect(problems).to have(0).problem
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
5
23
|
context 'a proper reference' do
|
6
24
|
let(:msg) { 'whitespce between reference type and title' }
|
7
25
|
let(:code) { "file { 'foo': ensure => file, notify => Title['one'],}" }
|
@@ -24,4 +42,17 @@ describe 'resource_reference_without_whitespace' do
|
|
24
42
|
end
|
25
43
|
end
|
26
44
|
|
45
|
+
context 'a whitespace between reference and bracket inside an array' do
|
46
|
+
let(:msg) { 'whitespce between reference type and title' }
|
47
|
+
let(:code) { "file { 'foo': ensure => file, consume => [ Title ['one'], Title['two']],}" }
|
48
|
+
|
49
|
+
it 'should only detect a single problem' do
|
50
|
+
expect(problems).to have(1).problem
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'should create an error' do
|
54
|
+
expect(problems).to contain_error(msg).on_line(1)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
27
58
|
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.7
|
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-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: puppet-lint
|