puppet-lint-resource_reference_syntax 1.0.3 → 1.0.4

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: d237aec2bf27b27da3e1ba61f593a4359128224f
4
- data.tar.gz: 6852215c95538df3aa99ee5d8f24608a8694bd18
3
+ metadata.gz: 968682a225e6084c2004bde43dfb6c9ea5c738fb
4
+ data.tar.gz: c996f8d7c54b06799e5c24b2b8518f035098e1d5
5
5
  SHA512:
6
- metadata.gz: 2fc6e4c9c1f31998d34d6f1a5b062b3ab19fe9d629e4507a8ace17622ace54610d9e2baf5c4c44c81736e0d7cf63f55965a9a6f575af67a9ea61cee1a539206e
7
- data.tar.gz: 3f4eb2990f6012b640a4717ff44786c2c8bba2f5a5ee329cb82b1f9e8a6db3f3d72dcf7d88d2d2244957b749562ed31208ff4144ffc57df13dca099de33f16f3
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
- 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
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, notify => Title ['one'],}" }
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.3
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-13 00:00:00.000000000 Z
11
+ date: 2015-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: puppet-lint