puppet-lint-resource_reference_syntax 1.0.3 → 1.0.4
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 +7 -9
- data/lib/puppet-lint/plugins/resource_reference_without_whitespace.rb +1 -1
- data/spec/puppet-lint/plugins/resource_reference_without_title_capital_spec.rb +13 -0
- data/spec/puppet-lint/plugins/resource_reference_without_whitespace_spec.rb +1 -1
- 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: 968682a225e6084c2004bde43dfb6c9ea5c738fb
|
4
|
+
data.tar.gz: c996f8d7c54b06799e5c24b2b8518f035098e1d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a165376ff9f202412f4a163f0b094e8c3dee55637cfded25abc8f140f83dfa5e01ca1c13eea651df41efb5f06420ba45796152897508c3c5a66918691004d84
|
7
|
+
data.tar.gz: 1fdcc56b72dfd1e71462c6422e950032412a50eb14bb7348f042f3b6d23653895c7da2882e59bd91f14875d2dd2e3abfdea61396001853a0c9c69a0a03c7625f
|
@@ -2,17 +2,15 @@ PuppetLint.new_check(:resource_reference_without_title_capital) do
|
|
2
2
|
def check
|
3
3
|
resource_indexes.each do |resource|
|
4
4
|
resource[:param_tokens].select { |param_token|
|
5
|
-
['require', 'subscribe', 'notify', 'before'].include? param_token.value
|
5
|
+
['require', 'subscribe', 'notify', 'before', 'consume', 'export'].include? param_token.value
|
6
6
|
}.each do |param_token|
|
7
7
|
value_token = param_token.next_code_token.next_code_token.next_code_token.next_token
|
8
|
-
unless value_token.type == :SSTRING
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
}
|
15
|
-
end
|
8
|
+
unless value_token.type == :SSTRING or value_token.type == :VARIABLE
|
9
|
+
notify :error, {
|
10
|
+
:message => 'resource reference with title with capital letter',
|
11
|
+
:line => value_token.line,
|
12
|
+
:column => value_token.column
|
13
|
+
}
|
16
14
|
end
|
17
15
|
end
|
18
16
|
end
|
@@ -2,7 +2,7 @@ PuppetLint.new_check(:resource_reference_without_whitespace) do
|
|
2
2
|
def check
|
3
3
|
resource_indexes.each do |resource|
|
4
4
|
resource[:param_tokens].select { |param_token|
|
5
|
-
['require', 'subscribe', 'notify', 'before'].include? param_token.value
|
5
|
+
['require', 'subscribe', 'notify', 'before', 'consume', 'export'].include? param_token.value
|
6
6
|
}.each do |param_token|
|
7
7
|
value_token = param_token.next_code_token.next_code_token.next_token
|
8
8
|
if value_token.type != :LBRACK
|
@@ -40,4 +40,17 @@ describe 'resource_reference_without_title_capital' do
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
+
context 'resource reference with title without quotes' do
|
44
|
+
let(:msg) { 'resource reference with title with capital letter' }
|
45
|
+
let(:code) { "file { 'foo': ensure => file, notify => Title[one],}" }
|
46
|
+
|
47
|
+
it 'should only detect a single problem' do
|
48
|
+
expect(problems).to have(1).problem
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'should create an error' do
|
52
|
+
expect(problems).to contain_error(msg).on_line(1)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
43
56
|
end
|
@@ -13,7 +13,7 @@ describe 'resource_reference_without_whitespace' do
|
|
13
13
|
|
14
14
|
context 'a whitespace between reference and bracket' do
|
15
15
|
let(:msg) { 'whitespce between reference type and title' }
|
16
|
-
let(:code) { "file { 'foo': ensure => file,
|
16
|
+
let(:code) { "file { 'foo': ensure => file, consume => Title ['one'],}" }
|
17
17
|
|
18
18
|
it 'should only detect a single problem' do
|
19
19
|
expect(problems).to have(1).problem
|
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.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Alfke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: puppet-lint
|