puppet-lint-no_erb_template-check 0.1.1 → 1.0.0

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
- SHA1:
3
- metadata.gz: 051f9779ff89fc7f3e29a070c1dc1d017b51021c
4
- data.tar.gz: 46adb3a3d101a9b720a8e59639cbd2f9af15d0e3
2
+ SHA256:
3
+ metadata.gz: 91b13539a52820f3be406351677976dacf093c757d5f5f4b597b49ac26fbb9ad
4
+ data.tar.gz: d582ac64d706530d7f1023a4a80747ee1a830e699cecaedc4fc9e184d8c6d2c4
5
5
  SHA512:
6
- metadata.gz: 2ffebe538fd19b2e069b7fb32e36ab1d5a57014be5cbb97bdaa130a1a50aa28b235e610f12aa4f32527a86b7071fcc1c817246d2dfa7e594c969c269c0e3397c
7
- data.tar.gz: acc8e28c6404055afd0b54a520943d0c3b79b92a8e76b4c16d80447623b64cbd37a4cf4edea40331b48d2c3c0c9d278adcb25e2fb7ff5368343f2857ac1f3e3b
6
+ metadata.gz: '083c5611ff0cff68a80400747a5ba0409ed8449ed406f0a9a22b775061b58a1d2df544941012f4b98eade7174596c2d820e2b4ce7f589b29353a11d6562e331c'
7
+ data.tar.gz: c444c200dc969f966dbe651fd81eb05a44129f7a0bb193560639a39caec69124df19767f3312f07a2d5de5801872527ca523b444de31122a6a978865155a8384
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # puppet-lint no ERB templates check
2
2
 
3
+ [![Actions Status](https://github.com/deanwilson/puppet-lint-no_erb_template-check/workflows/Ruby/badge.svg)](https://github.com/deanwilson/puppet-lint-no_erb_template-check/actions)
4
+
3
5
  As part of the migration to a cleaner, Puppet 4 enhanced, code base one
4
6
  of the suggestions is to move from the old ERB (Embedded Ruby)
5
7
  templates to the newer, kinder, gentler `epp` (Embedded Puppet
@@ -1,8 +1,10 @@
1
1
  PuppetLint.new_check(:no_erb_template) do
2
2
  def check
3
- functions = ['template', 'inline_template']
3
+ functions = %w[template inline_template]
4
4
 
5
- tokens.select { |t| t.type == :NAME and functions.include? t.value }.each do |function_token|
5
+ function_tokens = tokens.select { |t| (t.type == :NAME or t.type == :FUNCTION_NAME) and functions.include? t.value }
6
+
7
+ function_tokens.each do |function_token|
6
8
  next unless function_token.next_code_token.type == :LPAREN
7
9
 
8
10
  key_token = function_token.next_code_token.next_code_token
@@ -1,80 +1,80 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe 'no_erb_template' do
4
- context 'class with no template calls' do
4
+ context 'when class contains no template function calls' do
5
5
  let(:code) do
6
- <<-EOS
6
+ <<-TEST_CLASS
7
7
  class no_template_calls {
8
8
  file { '/tmp/foo':
9
9
  content => 'bar',
10
10
  }
11
11
  }
12
- EOS
12
+ TEST_CLASS
13
13
  end
14
14
 
15
- it 'should not detect any problems' do
15
+ it 'does not detect any problems' do
16
16
  expect(problems).to have(0).problems
17
17
  end
18
18
  end
19
19
 
20
- context 'class with an epp template call' do
20
+ context 'when class contains an epp template call' do
21
21
  let(:code) do
22
- <<-EOS
22
+ <<-TEST_CLASS
23
23
  class epp_call {
24
24
  file { '/tmp/foo':
25
25
  content => epp('mymodule/bar.epp'),
26
26
  }
27
27
  }
28
- EOS
28
+ TEST_CLASS
29
29
  end
30
30
 
31
- it 'should not detect any problems' do
31
+ it 'does not detect any problems' do
32
32
  expect(problems).to have(0).problems
33
33
  end
34
34
  end
35
35
 
36
36
  # and these should cause failiures
37
37
 
38
- context 'class with a template call' do
38
+ context 'when class contains a template call' do
39
39
  let(:msg) { 'template() function call. Use epp() instead' }
40
40
 
41
41
  let(:code) do
42
- <<-EOS
42
+ <<-TEST_CLASS
43
43
  class template_call {
44
44
  file { '/tmp/foo':
45
45
  content => template('mymodule/bar.epp'),
46
46
  }
47
47
  }
48
- EOS
48
+ TEST_CLASS
49
49
  end
50
50
 
51
- it 'should detect a single problem' do
51
+ it 'detects a single problem' do
52
52
  expect(problems).to have(1).problem
53
53
  end
54
54
 
55
- it 'should create an error' do
55
+ it 'creates an error' do
56
56
  expect(problems).to contain_warning(msg).on_line(3).in_column(33)
57
57
  end
58
58
  end
59
59
 
60
- context 'class with an inline_template call' do
60
+ context 'when class contains an inline_template call' do
61
61
  let(:msg) { 'inline_template() function call. Use inline_epp() instead' }
62
62
 
63
63
  let(:code) do
64
- <<-EOS
64
+ <<-TEST_CLASS
65
65
  class template_call {
66
66
  file { '/tmp/foo':
67
67
  content => inline_template('This is a rubbish template'),
68
68
  }
69
69
  }
70
- EOS
70
+ TEST_CLASS
71
71
  end
72
72
 
73
- it 'should detect a single problem' do
73
+ it 'detects a single problem' do
74
74
  expect(problems).to have(1).problem
75
75
  end
76
76
 
77
- it 'should create an error' do
77
+ it 'creates an error' do
78
78
  expect(problems).to contain_warning(msg).on_line(3).in_column(40)
79
79
  end
80
80
  end
@@ -1,3 +1,8 @@
1
+ require 'simplecov'
2
+ SimpleCov.start do
3
+ enable_coverage :branch
4
+ end
5
+
1
6
  require 'puppet-lint'
2
7
 
3
8
  PuppetLint::Plugins.load_spec_helper
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-lint-no_erb_template-check
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dean Wilson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-21 00:00:00.000000000 Z
11
+ date: 2020-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: puppet-lint
@@ -30,22 +30,36 @@ dependencies:
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '3.0'
33
+ - !ruby/object:Gem::Dependency
34
+ name: rake
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: 13.0.0
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: 13.0.0
33
47
  - !ruby/object:Gem::Dependency
34
48
  name: rspec
35
49
  requirement: !ruby/object:Gem::Requirement
36
50
  requirements:
37
51
  - - "~>"
38
52
  - !ruby/object:Gem::Version
39
- version: '3.0'
53
+ version: 3.10.0
40
54
  type: :development
41
55
  prerelease: false
42
56
  version_requirements: !ruby/object:Gem::Requirement
43
57
  requirements:
44
58
  - - "~>"
45
59
  - !ruby/object:Gem::Version
46
- version: '3.0'
60
+ version: 3.10.0
47
61
  - !ruby/object:Gem::Dependency
48
- name: rspec-its
62
+ name: rspec-collection_matchers
49
63
  requirement: !ruby/object:Gem::Requirement
50
64
  requirements:
51
65
  - - "~>"
@@ -59,7 +73,7 @@ dependencies:
59
73
  - !ruby/object:Gem::Version
60
74
  version: '1.0'
61
75
  - !ruby/object:Gem::Dependency
62
- name: rspec-collection_matchers
76
+ name: rspec-its
63
77
  requirement: !ruby/object:Gem::Requirement
64
78
  requirements:
65
79
  - - "~>"
@@ -73,47 +87,61 @@ dependencies:
73
87
  - !ruby/object:Gem::Version
74
88
  version: '1.0'
75
89
  - !ruby/object:Gem::Dependency
76
- name: rake
90
+ name: rspec-json_expectations
77
91
  requirement: !ruby/object:Gem::Requirement
78
92
  requirements:
79
- - - ">="
93
+ - - "~>"
80
94
  - !ruby/object:Gem::Version
81
- version: '0'
95
+ version: '2.2'
82
96
  type: :development
83
97
  prerelease: false
84
98
  version_requirements: !ruby/object:Gem::Requirement
85
99
  requirements:
86
- - - ">="
100
+ - - "~>"
87
101
  - !ruby/object:Gem::Version
88
- version: '0'
102
+ version: '2.2'
89
103
  - !ruby/object:Gem::Dependency
90
- name: pry
104
+ name: rubocop
91
105
  requirement: !ruby/object:Gem::Requirement
92
106
  requirements:
93
- - - ">="
107
+ - - "~>"
94
108
  - !ruby/object:Gem::Version
95
- version: '0'
109
+ version: 0.93.0
96
110
  type: :development
97
111
  prerelease: false
98
112
  version_requirements: !ruby/object:Gem::Requirement
99
113
  requirements:
100
- - - ">="
114
+ - - "~>"
101
115
  - !ruby/object:Gem::Version
102
- version: '0'
116
+ version: 0.93.0
103
117
  - !ruby/object:Gem::Dependency
104
- name: rubocop
118
+ name: rubocop-rspec
105
119
  requirement: !ruby/object:Gem::Requirement
106
120
  requirements:
107
121
  - - "~>"
108
122
  - !ruby/object:Gem::Version
109
- version: 0.36.0
123
+ version: 1.44.1
110
124
  type: :development
111
125
  prerelease: false
112
126
  version_requirements: !ruby/object:Gem::Requirement
113
127
  requirements:
114
128
  - - "~>"
115
129
  - !ruby/object:Gem::Version
116
- version: 0.36.0
130
+ version: 1.44.1
131
+ - !ruby/object:Gem::Dependency
132
+ name: simplecov
133
+ requirement: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - "~>"
136
+ - !ruby/object:Gem::Version
137
+ version: 0.20.0
138
+ type: :development
139
+ prerelease: false
140
+ version_requirements: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - "~>"
143
+ - !ruby/object:Gem::Version
144
+ version: 0.20.0
117
145
  description: |2
118
146
  Extends puppet-lint to ensure there are no calls to the template
119
147
  or inline_template function as an aid to migrating to epp templates.
@@ -139,7 +167,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
139
167
  requirements:
140
168
  - - ">="
141
169
  - !ruby/object:Gem::Version
142
- version: '0'
170
+ version: 2.5.0
143
171
  required_rubygems_version: !ruby/object:Gem::Requirement
144
172
  requirements:
145
173
  - - ">="
@@ -147,11 +175,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
175
  version: '0'
148
176
  requirements: []
149
177
  rubyforge_project:
150
- rubygems_version: 2.4.8
178
+ rubygems_version: 2.7.6
151
179
  signing_key:
152
180
  specification_version: 4
153
181
  summary: puppet-lint no_erb_template check
154
182
  test_files:
155
- - spec/spec_helper.rb
156
183
  - spec/puppet-lint/plugins/no_erb_template_spec.rb
157
- has_rdoc:
184
+ - spec/spec_helper.rb