puppet-lint-module_reference-check 0.1.0 → 0.1.1
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee854abe4315d279e6979682faf87b6690d950f1e7f9c7a91d8482c6289195c9
|
4
|
+
data.tar.gz: a4253c750197e353a05a78adb1de8f7206832bd9fd8e366d19699fcf947d78c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 706218a66652064c2270eaf2d0a051265f6bcc661d52e45e3c7c9c15c8bb0f1fb27bb04df20b5302bfbac044fafa4a5fc0506886c32628d11398d86e167c44a4
|
7
|
+
data.tar.gz: ae4b93169eb6cdaa3c8cd24247ef5fb34b8105759db84a275fc4ca09eba5e0856f7d7e8b19174aa4e8967866378ce0e605e1900c1cd68d542f167c70c3517bb7
|
@@ -130,7 +130,7 @@ PuppetLint.new_check(:module_reference) do
|
|
130
130
|
return return_object if captures['name'].match?(%r(https?://))
|
131
131
|
|
132
132
|
reference = @workflow.references.select { |ref| ref[:name] == captures['name'] }
|
133
|
-
return
|
133
|
+
return return_object if reference.empty?
|
134
134
|
|
135
135
|
return_object[:type] = reference.first[:type]
|
136
136
|
else
|
@@ -34,6 +34,31 @@ describe 'module_reference' do
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
+
context 'valid code with reference to unused module' do
|
38
|
+
let(:code) do
|
39
|
+
<<~CODE
|
40
|
+
# @ref apache
|
41
|
+
# @note puppetlabs-apache
|
42
|
+
# @see https://forge.puppet.com/modules/puppetlabs/apache
|
43
|
+
#
|
44
|
+
# @see profile::test
|
45
|
+
#
|
46
|
+
# @see profile::testfeature - Feature "test"
|
47
|
+
class test () {
|
48
|
+
include profile::test
|
49
|
+
class {
|
50
|
+
'apache':
|
51
|
+
}
|
52
|
+
include apache
|
53
|
+
}
|
54
|
+
CODE
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'should detect detect any problems' do
|
58
|
+
expect(problems).to have(0).problems
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
37
62
|
context 'code with missing internal link' do
|
38
63
|
let(:code) do
|
39
64
|
<<~CODE
|
@@ -165,35 +190,6 @@ describe 'module_reference' do
|
|
165
190
|
end
|
166
191
|
end
|
167
192
|
|
168
|
-
context 'code with reference to unused module' do
|
169
|
-
let(:code) do
|
170
|
-
<<~CODE
|
171
|
-
# @ref apache
|
172
|
-
# @note puppetlabs-apache
|
173
|
-
# @see https://forge.puppet.com/modules/puppetlabs/apache
|
174
|
-
#
|
175
|
-
# @see profile::test
|
176
|
-
#
|
177
|
-
# @see profile::testfeature - Feature "test"
|
178
|
-
class test () {
|
179
|
-
include profile::test
|
180
|
-
class {
|
181
|
-
'apache':
|
182
|
-
}
|
183
|
-
include apache
|
184
|
-
}
|
185
|
-
CODE
|
186
|
-
end
|
187
|
-
|
188
|
-
it 'should detect exactly one problem' do
|
189
|
-
expect(problems).to have(1).problems
|
190
|
-
end
|
191
|
-
|
192
|
-
it 'should create a warning' do
|
193
|
-
expect(problems).to contain_warning('Can\'t find referenced module profile::testfeature').on_line(1).in_column(1)
|
194
|
-
end
|
195
|
-
end
|
196
|
-
|
197
193
|
context 'code with unsorted component references' do
|
198
194
|
let(:code) do
|
199
195
|
<<~CODE
|