puppet-lint-resource_reference_syntax 1.0.11 → 1.0.12

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: 6bec0b0cda5b6e0baaf5be0d7384eeebb8bd54f3
4
- data.tar.gz: a1b14449a5dd89ea9519482f7b58601f008d2a83
3
+ metadata.gz: 92733fa76520fe90aa7a08f0ffdba688819af9d1
4
+ data.tar.gz: 819e4396e020382c390c8b5f7b8e07a20136dd64
5
5
  SHA512:
6
- metadata.gz: cc948517e4a2e414e73243d6da93e427a6dbfc0fe24c74847d6a79bc4596b86d3ba8607b399b9aa64d0b9858b8a6b613230b3eca65edfec326c522ec8eac7707
7
- data.tar.gz: ca4d94b023baa8b20a2124fcb78b604141d827bd562074ae0b572d2ad92135f8a42e9959a20d71b85fb9df43c6f3c847779fd0eef79b8ae2ad3988f7bda2626e
6
+ metadata.gz: cb0dd4e61f3c1f5f0d4b2c3463260f45b369f6eb462063c6a26699ed39dd348090995a230bb8c15047e98a46e2ed85dbe08c57d285d91e279284417a7dfb9213
7
+ data.tar.gz: 6f58ae49f10b4f04d08cf80137187401a4d28d0d6687ace5be58f62b3757f097d6b3c600bfc95e7fa9b8514c8fd3a4f0532bdb4e2778dbd6bae6ab27cc2679dd
@@ -1,3 +1,4 @@
1
+ require 'pry'
1
2
  PuppetLint.new_check(:resource_reference_without_whitespace) do
2
3
  def check
3
4
  resource_indexes.each do |resource|
@@ -7,8 +8,9 @@ PuppetLint.new_check(:resource_reference_without_whitespace) do
7
8
  check = param_token
8
9
  case check.type
9
10
  when :CLASSREF
11
+ # binding.pry
10
12
  begin
11
- if check.next_token.type == :WHITESPACE
13
+ if check.next_token.type == :WHITESPACE and check.next_code_token.type == :LBRACK
12
14
  notify :error, {
13
15
  :message => 'whitespce between reference type and title',
14
16
  :line => check.line,
@@ -67,7 +67,7 @@ describe 'resource_reference_without_whitespace' do
67
67
  let(:msg) { 'whitespce between reference type and title' }
68
68
  let(:code) { "package { 'one': ensure => present, } Package ['one'] ~> Service ['two']" }
69
69
 
70
- it 'should detect three problems' do
70
+ it 'should detect two problems' do
71
71
  expect(problems).to have(2).problem
72
72
  end
73
73
 
@@ -76,4 +76,25 @@ describe 'resource_reference_without_whitespace' do
76
76
  end
77
77
  end
78
78
 
79
+ context 'more resources and a whitespace between reference and bracket on chains' do
80
+ let(:msg) { 'whitespce between reference type and title' }
81
+ let(:code) { "package { 'one': ensure => present, } package { 'two': ensure => present, } Package ['one'] ~> Service['two']" }
82
+
83
+ it 'should detect one problem' do
84
+ expect(problems).to have(2).problem
85
+ end
86
+
87
+ it 'should create an error' do
88
+ expect(problems).to contain_error(msg).on_line(1)
89
+ end
90
+ end
91
+
92
+ context 'collectors should not cause an error' do
93
+ let(:code) { "@package { 'bar': ensure => installed,} Package <| |>" }
94
+
95
+ it 'should detect no problem' do
96
+ expect(problems).to have(0).problem
97
+ end
98
+ end
99
+
79
100
  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.11
4
+ version: 1.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Alfke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-30 00:00:00.000000000 Z
11
+ date: 2018-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: puppet-lint