puppet-lint-manifest_whitespace-check 0.1.16 → 0.1.17
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 242cfac889870bbdd8d1346f1adafb8348b868945e9cfbe9adebebf6c4468c59
|
4
|
+
data.tar.gz: 0fd2197f54e3f911e077d3315458a0e2c44e69230570757cf26a7fc26db0d89e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc1eea7da122458e2cda3cad1820548774a57149ec6ae6061fd75e20388a82af98e4d93e740f15bfdb623e6f4ee5cd647d189e6c30285238712040eddbcc8f0f
|
7
|
+
data.tar.gz: 80b25a77380531e248bb146af17a010818e4782698fe85972cf97245a27ab2383fb8b2a3cc69875c56afd6a3ef3e3fe769d05a770bd858a45e5de4e55af5aecd
|
@@ -43,20 +43,22 @@ PuppetLint.new_check(:manifest_whitespace_class_name_single_space_after) do
|
|
43
43
|
notify(
|
44
44
|
:error,
|
45
45
|
message: 'there should be a single space between the class or resource name and the next item',
|
46
|
-
line:
|
47
|
-
column:
|
48
|
-
token:
|
46
|
+
line: name_token.line,
|
47
|
+
column: name_token.column,
|
48
|
+
token: name_token,
|
49
49
|
)
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
53
|
def fix(problem)
|
54
54
|
token = problem[:token]
|
55
|
-
next_code_token = next_non_space_token(token.prev_token)
|
56
55
|
|
57
|
-
|
58
|
-
|
59
|
-
|
56
|
+
next_token = token.next_token
|
57
|
+
next_code_token = next_non_space_token(token)
|
58
|
+
|
59
|
+
while next_token != next_code_token
|
60
|
+
remove_token(next_token)
|
61
|
+
next_token = next_token.next_token
|
60
62
|
end
|
61
63
|
|
62
64
|
add_token(tokens.index(next_code_token), new_single_space)
|
@@ -119,7 +119,7 @@ describe 'manifest_whitespace_class_name_single_space_after' do
|
|
119
119
|
end
|
120
120
|
|
121
121
|
it 'should create a error' do
|
122
|
-
expect(problems).to contain_error(single_space_msg).on_line(6).in_column(
|
122
|
+
expect(problems).to contain_error(single_space_msg).on_line(6).in_column(7)
|
123
123
|
end
|
124
124
|
end
|
125
125
|
|
@@ -183,7 +183,7 @@ describe 'manifest_whitespace_class_name_single_space_after' do
|
|
183
183
|
end
|
184
184
|
|
185
185
|
it 'should create a error' do
|
186
|
-
expect(problems).to contain_error(single_space_msg).on_line(6).in_column(
|
186
|
+
expect(problems).to contain_error(single_space_msg).on_line(6).in_column(7)
|
187
187
|
end
|
188
188
|
end
|
189
189
|
|
@@ -245,7 +245,7 @@ describe 'manifest_whitespace_class_name_single_space_after' do
|
|
245
245
|
end
|
246
246
|
|
247
247
|
it 'should create a error' do
|
248
|
-
expect(problems).to contain_error(single_space_msg).on_line(6).in_column(
|
248
|
+
expect(problems).to contain_error(single_space_msg).on_line(6).in_column(7)
|
249
249
|
end
|
250
250
|
end
|
251
251
|
|
@@ -307,7 +307,7 @@ describe 'manifest_whitespace_class_name_single_space_after' do
|
|
307
307
|
end
|
308
308
|
|
309
309
|
it 'should create a error' do
|
310
|
-
expect(problems).to contain_error(single_space_msg).on_line(6).in_column(
|
310
|
+
expect(problems).to contain_error(single_space_msg).on_line(6).in_column(7)
|
311
311
|
end
|
312
312
|
end
|
313
313
|
|
@@ -372,7 +372,7 @@ describe 'manifest_whitespace_class_name_single_space_after' do
|
|
372
372
|
end
|
373
373
|
|
374
374
|
it 'should create a error' do
|
375
|
-
expect(problems).to contain_error(single_space_msg).on_line(6).in_column(
|
375
|
+
expect(problems).to contain_error(single_space_msg).on_line(6).in_column(7)
|
376
376
|
end
|
377
377
|
end
|
378
378
|
|
@@ -34,6 +34,46 @@ describe 'manifest_whitespace_opening_brace_before' do
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
+
context 'with class no spaces' do
|
38
|
+
let(:code) do
|
39
|
+
<<~EOF
|
40
|
+
class example{
|
41
|
+
# some generic comment
|
42
|
+
}
|
43
|
+
EOF
|
44
|
+
end
|
45
|
+
|
46
|
+
context 'with fix disabled' do
|
47
|
+
it 'should detect a problem' do
|
48
|
+
expect(problems).to have(1).problem
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'should create a error' do
|
52
|
+
expect(problems).to contain_error(opening_brace_msg).on_line(1).in_column(14)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
context 'with fix enabled' do
|
57
|
+
before do
|
58
|
+
PuppetLint.configuration.fix = true
|
59
|
+
end
|
60
|
+
|
61
|
+
after do
|
62
|
+
PuppetLint.configuration.fix = false
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'should add a space' do
|
66
|
+
expect(manifest).to eq(
|
67
|
+
<<~EOF,
|
68
|
+
class example {
|
69
|
+
# some generic comment
|
70
|
+
}
|
71
|
+
EOF
|
72
|
+
)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
37
77
|
context 'with no spaces' do
|
38
78
|
let(:code) do
|
39
79
|
<<~EOF
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet-lint-manifest_whitespace-check
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jo Vandeginste
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: puppet-lint
|