puppet-lint-resource_reference_syntax 1.0.10 → 1.0.11
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6bec0b0cda5b6e0baaf5be0d7384eeebb8bd54f3
|
4
|
+
data.tar.gz: a1b14449a5dd89ea9519482f7b58601f008d2a83
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc948517e4a2e414e73243d6da93e427a6dbfc0fe24c74847d6a79bc4596b86d3ba8607b399b9aa64d0b9858b8a6b613230b3eca65edfec326c522ec8eac7707
|
7
|
+
data.tar.gz: ca4d94b023baa8b20a2124fcb78b604141d827bd562074ae0b572d2ad92135f8a42e9959a20d71b85fb9df43c6f3c847779fd0eef79b8ae2ad3988f7bda2626e
|
@@ -1,28 +1,20 @@
|
|
1
1
|
PuppetLint.new_check(:resource_reference_without_whitespace) do
|
2
2
|
def check
|
3
3
|
resource_indexes.each do |resource|
|
4
|
-
|
5
|
-
[
|
4
|
+
tokens.select { |token|
|
5
|
+
[:CLASSREF].include? token.type
|
6
6
|
}.each do |param_token|
|
7
|
-
|
8
|
-
check
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
:column => value_token.next_token.next_token.column
|
18
|
-
}
|
19
|
-
end
|
20
|
-
value_token = value_token.next_token
|
21
|
-
check = value_token.next_token
|
7
|
+
check = param_token
|
8
|
+
case check.type
|
9
|
+
when :CLASSREF
|
10
|
+
begin
|
11
|
+
if check.next_token.type == :WHITESPACE
|
12
|
+
notify :error, {
|
13
|
+
:message => 'whitespce between reference type and title',
|
14
|
+
:line => check.line,
|
15
|
+
:column => check.column
|
16
|
+
}
|
22
17
|
end
|
23
|
-
else
|
24
|
-
value_token = value_token.next_token
|
25
|
-
check = value_token.next_token
|
26
18
|
end
|
27
19
|
end
|
28
20
|
end
|
@@ -56,11 +56,24 @@ describe 'resource_reference_without_whitespace' do
|
|
56
56
|
end
|
57
57
|
|
58
58
|
context 'stay within the parameter context' do
|
59
|
-
let(:code) { "package { 'bar': ensure => installed,} exec { 'baz': require => Package['bar'],}
|
59
|
+
let(:code) { "package { 'bar': ensure => installed,} exec { 'baz': require => Package['bar'],} file { 'foo': ensure => file,}" }
|
60
60
|
|
61
61
|
it 'should detect no problem' do
|
62
62
|
expect(problems).to have(0).problem
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
+
context 'a whitespace between reference and bracket on chains' do
|
67
|
+
let(:msg) { 'whitespce between reference type and title' }
|
68
|
+
let(:code) { "package { 'one': ensure => present, } Package ['one'] ~> Service ['two']" }
|
69
|
+
|
70
|
+
it 'should detect three problems' do
|
71
|
+
expect(problems).to have(2).problem
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'should create an error' do
|
75
|
+
expect(problems).to contain_error(msg).on_line(1)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
66
79
|
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.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Alfke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: puppet-lint
|
@@ -86,6 +86,20 @@ dependencies:
|
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '0'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: simplecov
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
89
103
|
description: |2
|
90
104
|
Extends puppet-lint to ensure that the reference syntax follows Puppet 4 style
|
91
105
|
email: ma@example42.com
|