puppet-lint-manifest_whitespace-check 0.1.13 → 0.1.14
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: 5f942c3097eac960a4830626b7950525074c9c39ab1ff401d04e1256ebda861e
|
4
|
+
data.tar.gz: 9aa3c04aa40c1c0f5349044208b717c3c387de7321286c23b53bc3b31169d8c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: adb52463b3cc9dee9f8291cf1ef24eb2ecb4e804ac381f7151d7d633bfe2d7c223d385da5ea21b0ceb75921d3d2241ce28a83672554edc74cfdb0b8ff11b1cb1
|
7
|
+
data.tar.gz: 3770c9176be5522c65f47d833a34e9430529b327980f0f237d2fa01dc2ddc3dbec0bb8f130110c1711d013e9db50d392c281bed38f351c53aec47e8a3e059977
|
@@ -25,7 +25,7 @@ PuppetLint.new_check(:manifest_whitespace_closing_brace_before) do
|
|
25
25
|
|
26
26
|
notify(
|
27
27
|
:error,
|
28
|
-
message: 'there should be a
|
28
|
+
message: 'there should be a single space or newline before a closing brace',
|
29
29
|
line: prev_code_token.next_token.line,
|
30
30
|
column: prev_code_token.next_token.column,
|
31
31
|
token: prev_code_token.next_token,
|
@@ -51,7 +51,7 @@ PuppetLint.new_check(:manifest_whitespace_closing_brace_before) do
|
|
51
51
|
next_token = next_token.next_token
|
52
52
|
end
|
53
53
|
|
54
|
-
if next_token.type == :RBRACE && !%i[LBRACE
|
54
|
+
if next_token.type == :RBRACE && !%i[LBRACE NEWLINE INDENT].include?(next_token.prev_token.type)
|
55
55
|
add_token(tokens.index(next_token), new_single_space)
|
56
56
|
end
|
57
57
|
end
|
@@ -3,7 +3,37 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
describe 'manifest_whitespace_closing_brace_before' do
|
6
|
-
let(:closing_brace_msg) { 'there should be a
|
6
|
+
let(:closing_brace_msg) { 'there should be a single space or newline before a closing brace' }
|
7
|
+
|
8
|
+
context 'with plus' do
|
9
|
+
let(:code) do
|
10
|
+
<<~EOF
|
11
|
+
$my_images = { 'default' => {}}
|
12
|
+
EOF
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'with fix enabled' do
|
16
|
+
before do
|
17
|
+
PuppetLint.configuration.fix = true
|
18
|
+
end
|
19
|
+
|
20
|
+
after do
|
21
|
+
PuppetLint.configuration.fix = false
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should fix a error' do
|
25
|
+
expect(problems).to contain_fixed(closing_brace_msg)
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should add spaces' do
|
29
|
+
expect(manifest).to eq(
|
30
|
+
<<~EOF,
|
31
|
+
$my_images = { 'default' => {} }
|
32
|
+
EOF
|
33
|
+
)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
7
37
|
|
8
38
|
context 'with nested hash' do
|
9
39
|
let(:code) do
|