puppet-lint-resource_reference_syntax 1.0.1 → 1.0.2

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: 371616c14d5648e344a31fa1a7d31e350dadfbde
4
- data.tar.gz: 5045d5c117f7f684cce916b57baff43675dba38a
3
+ metadata.gz: 73c7049c068ecde592b71eb2cfbc542a4f0bd55d
4
+ data.tar.gz: c7b2fd27e59671362db4f8e13fa59cdbca9aea9f
5
5
  SHA512:
6
- metadata.gz: 5a0308cb0014b98fbb3790cb49a31298d0c478d516cddd8137e4474f45b554bd7355a78546e528764782e853ca7dbefb78cda1c7679cf118f2010f6ad9ef7d59
7
- data.tar.gz: cbf0d29ad77fceec6783e286f5cbf17af8d7739dcf612d9eea3e5991ca2f7a96771bf7af812a36ef5e5a246c23924c5a678edfff2b1f4091bc4aa9c822c33ec6
6
+ metadata.gz: ef016a2d6ad6992a427d7219cbdc3c70444498c70547f7367800c2b70f9907e4ef40c143b53034cecbd090f04ca9495e930f20a5c558beb2ab51bca9708f2414
7
+ data.tar.gz: 67282c88a86427cd528de11d11b53b5de1fbb5def830646e5970f2a39aed76ad99b91681000284f1422777f021f72b996b795800ba9d496beba06a6433319df7
data/README.md CHANGED
@@ -31,7 +31,7 @@ ERROR: whitespce between reference type and title on line 4
31
31
 
32
32
  **--fix support: No**
33
33
 
34
- This check will raise an error for any resource reference that uses the title with capital letter.
34
+ This check will raise an error for any resource reference that uses the title with capital letter without enclosed quotes.
35
35
 
36
36
  ```
37
37
  ERROR: resource reference with title with capital letter on line 4
@@ -4,13 +4,15 @@ PuppetLint.new_check(:resource_reference_without_title_capital) do
4
4
  resource[:param_tokens].select { |param_token|
5
5
  ['require', 'subscribe', 'notify', 'before'].include? param_token.value
6
6
  }.each do |param_token|
7
- value_token = param_token.next_code_token.next_code_token.next_code_token.next_code_token
8
- unless value_token.value =~ (/^[a-z]*$/)
9
- notify :error, {
10
- :message => 'resource reference with title with capital letter',
11
- :line => value_token.line,
12
- :column => value_token.column
13
- }
7
+ value_token = param_token.next_code_token.next_code_token.next_code_token.next_token
8
+ unless value_token.type == :SSTRING
9
+ unless value_token.value =~ (/^[a-z]*$/)
10
+ notify :error, {
11
+ :message => 'resource reference with title with capital letter',
12
+ :line => value_token.line,
13
+ :column => value_token.column
14
+ }
15
+ end
14
16
  end
15
17
  end
16
18
  end
@@ -11,6 +11,15 @@ describe 'resource_reference_without_title_capital' do
11
11
  end
12
12
  end
13
13
 
14
+ context 'a proper reference in quotes' do
15
+ let(:msg) { 'whitespce between reference type and title' }
16
+ let(:code) { "file { 'foo': ensure => file, notify => Title['One'],}" }
17
+
18
+ it 'should detect no problem' do
19
+ expect(problems).to have(0).problem
20
+ end
21
+ end
22
+
14
23
  context 'resource reference with title as capital letter' do
15
24
  let(:msg) { 'resource reference with title with capital letter' }
16
25
  let(:code) { "file { 'foo': ensure => file, notify => Title[One],}" }
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.1
4
+ version: 1.0.2
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-06 00:00:00.000000000 Z
11
+ date: 2015-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: puppet-lint