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: cf65ebeb1562c96b729170887f3f0858aa334167
4
- data.tar.gz: f958ba6c54fad7dfc3d0729159156b2721c752d0
3
+ metadata.gz: 6bec0b0cda5b6e0baaf5be0d7384eeebb8bd54f3
4
+ data.tar.gz: a1b14449a5dd89ea9519482f7b58601f008d2a83
5
5
  SHA512:
6
- metadata.gz: 61d6d864fdabfdc16324549676577a45a83a9e34956f629d9eb6d1f347c1f0ac1a96e4ee84604131c05536ab87948ff0ddfaeed90aa13a4cc3aace9bd71d97e8
7
- data.tar.gz: 1a649de579bedca54c45dbaa496e482c2ca4fa37d128879d45dced05f0eeff7f79f7307fb371cf11d550c87c269046068c01e93affe318730be4d4caa3240039
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
- resource[:param_tokens].select { |param_token|
5
- ['require', 'subscribe', 'notify', 'before', 'consume', 'export'].include? param_token.value
4
+ tokens.select { |token|
5
+ [:CLASSREF].include? token.type
6
6
  }.each do |param_token|
7
- value_token = param_token.next_code_token
8
- check = value_token.next_token
9
- until resource[:param_tokens].include? check or not resource[:tokens].include? check or 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 => value_token.next_token.next_token.line,
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'],} File { 'foo': ensure => file,}" }
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.10
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: 2016-11-18 00:00:00.000000000 Z
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