puppet-lint-no_erb_template-check 0.1.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/README.md +2 -0
- data/lib/puppet-lint/plugins/no_erb_template.rb +4 -2
- data/spec/puppet-lint/plugins/no_erb_template_spec.rb +18 -18
- data/spec/spec_helper.rb +5 -0
- metadata +50 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 91b13539a52820f3be406351677976dacf093c757d5f5f4b597b49ac26fbb9ad
|
4
|
+
data.tar.gz: d582ac64d706530d7f1023a4a80747ee1a830e699cecaedc4fc9e184d8c6d2c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
+
[](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 = [
|
3
|
+
functions = %w[template inline_template]
|
4
4
|
|
5
|
-
tokens.select { |t| t.type == :NAME and functions.include? t.value }
|
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
|
4
|
+
context 'when class contains no template function calls' do
|
5
5
|
let(:code) do
|
6
|
-
<<-
|
6
|
+
<<-TEST_CLASS
|
7
7
|
class no_template_calls {
|
8
8
|
file { '/tmp/foo':
|
9
9
|
content => 'bar',
|
10
10
|
}
|
11
11
|
}
|
12
|
-
|
12
|
+
TEST_CLASS
|
13
13
|
end
|
14
14
|
|
15
|
-
it '
|
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
|
20
|
+
context 'when class contains an epp template call' do
|
21
21
|
let(:code) do
|
22
|
-
<<-
|
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
|
-
|
28
|
+
TEST_CLASS
|
29
29
|
end
|
30
30
|
|
31
|
-
it '
|
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
|
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
|
-
<<-
|
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
|
-
|
48
|
+
TEST_CLASS
|
49
49
|
end
|
50
50
|
|
51
|
-
it '
|
51
|
+
it 'detects a single problem' do
|
52
52
|
expect(problems).to have(1).problem
|
53
53
|
end
|
54
54
|
|
55
|
-
it '
|
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
|
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
|
-
<<-
|
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
|
-
|
70
|
+
TEST_CLASS
|
71
71
|
end
|
72
72
|
|
73
|
-
it '
|
73
|
+
it 'detects a single problem' do
|
74
74
|
expect(problems).to have(1).problem
|
75
75
|
end
|
76
76
|
|
77
|
-
it '
|
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
|
data/spec/spec_helper.rb
CHANGED
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.
|
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:
|
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:
|
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:
|
60
|
+
version: 3.10.0
|
47
61
|
- !ruby/object:Gem::Dependency
|
48
|
-
name: rspec-
|
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-
|
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:
|
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: '
|
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: '
|
102
|
+
version: '2.2'
|
89
103
|
- !ruby/object:Gem::Dependency
|
90
|
-
name:
|
104
|
+
name: rubocop
|
91
105
|
requirement: !ruby/object:Gem::Requirement
|
92
106
|
requirements:
|
93
|
-
- - "
|
107
|
+
- - "~>"
|
94
108
|
- !ruby/object:Gem::Version
|
95
|
-
version:
|
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:
|
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:
|
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:
|
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:
|
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.
|
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
|
-
|
184
|
+
- spec/spec_helper.rb
|