puppet-lint-manifest_whitespace-check 0.2.8 → 0.2.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/puppet-lint/plugins/check_manifest_whitespace_closing_brace.rb +2 -6
- data/lib/puppet-lint/plugins/check_manifest_whitespace_opening_bracket.rb +2 -1
- data/spec/puppet-lint/plugins/manifest_whitespace_arrow_spaces_spec.rb +45 -45
- data/spec/puppet-lint/plugins/manifest_whitespace_class_header_spec.rb +63 -63
- data/spec/puppet-lint/plugins/manifest_whitespace_class_inherits_spec.rb +9 -9
- data/spec/puppet-lint/plugins/manifest_whitespace_closing_brace_spec.rb +53 -53
- data/spec/puppet-lint/plugins/manifest_whitespace_closing_bracket_spec.rb +67 -67
- data/spec/puppet-lint/plugins/manifest_whitespace_double_newline_end_of_file_spec.rb +27 -27
- data/spec/puppet-lint/plugins/manifest_whitespace_double_newline_spec.rb +9 -9
- data/spec/puppet-lint/plugins/manifest_whitespace_missing_newline_end_of_file_spec.rb +5 -5
- data/spec/puppet-lint/plugins/manifest_whitespace_newline_begin_of_file_spec.rb +25 -25
- data/spec/puppet-lint/plugins/manifest_whitespace_opening_brace_spec.rb +108 -96
- data/spec/puppet-lint/plugins/manifest_whitespace_opening_bracket_spec.rb +80 -68
- data/spec/spec_helper.rb +2 -0
- metadata +5 -5
@@ -3,9 +3,11 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
describe 'manifest_whitespace_double_newline_end_of_file' do
|
6
|
+
let(:single_newline_end_of_file_msg) { 'there should be a single newline at the end of a manifest' }
|
7
|
+
|
6
8
|
context 'with good example' do
|
7
9
|
let(:code) do
|
8
|
-
<<~
|
10
|
+
<<~CODE
|
9
11
|
class example (
|
10
12
|
|
11
13
|
|
@@ -14,51 +16,49 @@ describe 'manifest_whitespace_double_newline_end_of_file' do
|
|
14
16
|
|
15
17
|
|
16
18
|
}
|
17
|
-
|
19
|
+
CODE
|
18
20
|
end
|
19
21
|
|
20
|
-
it '
|
22
|
+
it 'does not detect any problems' do
|
21
23
|
expect(problems).to be_empty
|
22
24
|
end
|
23
25
|
end
|
24
26
|
|
25
|
-
let(:single_newline_end_of_file_msg) { 'there should be a single newline at the end of a manifest' }
|
26
|
-
|
27
27
|
context 'with fix disabled' do
|
28
28
|
context 'with 1 empty line at the end of a manifest' do
|
29
29
|
let(:code) do
|
30
|
-
<<~
|
30
|
+
<<~CODE
|
31
31
|
class example {
|
32
32
|
}
|
33
33
|
|
34
|
-
|
34
|
+
CODE
|
35
35
|
end
|
36
36
|
|
37
|
-
it '
|
37
|
+
it 'detects a single problem' do
|
38
38
|
expect(problems).to have(1).problem
|
39
39
|
end
|
40
40
|
|
41
|
-
it '
|
41
|
+
it 'creates a error' do
|
42
42
|
expect(problems).to contain_error(single_newline_end_of_file_msg).on_line(3).in_column(1)
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
46
|
context 'with 3 empty lines at the end of a manifest' do
|
47
47
|
let(:code) do
|
48
|
-
<<~
|
48
|
+
<<~CODE
|
49
49
|
class example {
|
50
50
|
}
|
51
51
|
|
52
52
|
|
53
53
|
|
54
|
-
|
54
|
+
CODE
|
55
55
|
end
|
56
56
|
|
57
|
-
it '
|
57
|
+
it 'detects 3 problems' do
|
58
58
|
expect(problems).to have(3).problem
|
59
59
|
end
|
60
60
|
|
61
|
-
it '
|
61
|
+
it 'creates a error' do
|
62
62
|
expect(problems).to contain_error(single_newline_end_of_file_msg).on_line(3).in_column(1)
|
63
63
|
expect(problems).to contain_error(single_newline_end_of_file_msg).on_line(4).in_column(1)
|
64
64
|
expect(problems).to contain_error(single_newline_end_of_file_msg).on_line(5).in_column(1)
|
@@ -77,58 +77,58 @@ describe 'manifest_whitespace_double_newline_end_of_file' do
|
|
77
77
|
|
78
78
|
context 'with 1 empty line at the end of a manifest' do
|
79
79
|
let(:code) do
|
80
|
-
<<~
|
80
|
+
<<~CODE
|
81
81
|
class example {
|
82
82
|
}
|
83
83
|
|
84
|
-
|
84
|
+
CODE
|
85
85
|
end
|
86
86
|
|
87
|
-
it '
|
87
|
+
it 'detects a single problem' do
|
88
88
|
expect(problems).to have(1).problem
|
89
89
|
end
|
90
90
|
|
91
|
-
it '
|
91
|
+
it 'fixes the manifest' do
|
92
92
|
expect(problems).to contain_fixed(single_newline_end_of_file_msg).on_line(3).in_column(1)
|
93
93
|
end
|
94
94
|
|
95
|
-
it '
|
95
|
+
it 'adds the final newline' do
|
96
96
|
expect(manifest).to eq(
|
97
|
-
<<~
|
97
|
+
<<~CODE,
|
98
98
|
class example {
|
99
99
|
}
|
100
|
-
|
100
|
+
CODE
|
101
101
|
)
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
105
105
|
context 'with 3 empty lines at the end of a manifest' do
|
106
106
|
let(:code) do
|
107
|
-
<<~
|
107
|
+
<<~CODE
|
108
108
|
class example {
|
109
109
|
}
|
110
110
|
|
111
111
|
|
112
112
|
|
113
|
-
|
113
|
+
CODE
|
114
114
|
end
|
115
115
|
|
116
|
-
it '
|
116
|
+
it 'detects 3 problems' do
|
117
117
|
expect(problems).to have(3).problem
|
118
118
|
end
|
119
119
|
|
120
|
-
it '
|
120
|
+
it 'fixes the manifest' do
|
121
121
|
expect(problems).to contain_fixed(single_newline_end_of_file_msg).on_line(3).in_column(1)
|
122
122
|
expect(problems).to contain_fixed(single_newline_end_of_file_msg).on_line(4).in_column(1)
|
123
123
|
expect(problems).to contain_fixed(single_newline_end_of_file_msg).on_line(5).in_column(1)
|
124
124
|
end
|
125
125
|
|
126
|
-
it '
|
126
|
+
it 'adds the final newline' do
|
127
127
|
expect(manifest).to eq(
|
128
|
-
<<~
|
128
|
+
<<~CODE,
|
129
129
|
class example {
|
130
130
|
}
|
131
|
-
|
131
|
+
CODE
|
132
132
|
)
|
133
133
|
end
|
134
134
|
end
|
@@ -7,22 +7,22 @@ describe 'manifest_whitespace_two_empty_lines' do
|
|
7
7
|
|
8
8
|
context 'with two spaces' do
|
9
9
|
let(:code) do
|
10
|
-
<<~
|
10
|
+
<<~CODE
|
11
11
|
class { 'example2':
|
12
12
|
param1 => 'value1',
|
13
13
|
|
14
14
|
|
15
15
|
param2 => 'value2',
|
16
16
|
}
|
17
|
-
|
17
|
+
CODE
|
18
18
|
end
|
19
19
|
|
20
20
|
context 'with fix disabled' do
|
21
|
-
it '
|
21
|
+
it 'detects a single problem' do
|
22
22
|
expect(problems).to have(1).problem
|
23
23
|
end
|
24
24
|
|
25
|
-
it '
|
25
|
+
it 'creates a error' do
|
26
26
|
expect(problems).to contain_error(single_space_msg).on_line(4).in_column(1)
|
27
27
|
end
|
28
28
|
end
|
@@ -36,23 +36,23 @@ describe 'manifest_whitespace_two_empty_lines' do
|
|
36
36
|
PuppetLint.configuration.fix = false
|
37
37
|
end
|
38
38
|
|
39
|
-
it '
|
39
|
+
it 'detects a single problem' do
|
40
40
|
expect(problems).to have(1).problem
|
41
41
|
end
|
42
42
|
|
43
|
-
it '
|
43
|
+
it 'fixes the manifest' do
|
44
44
|
expect(problems).to contain_fixed(single_space_msg)
|
45
45
|
end
|
46
46
|
|
47
|
-
it '
|
47
|
+
it 'fixes the space' do
|
48
48
|
expect(manifest).to eq(
|
49
|
-
<<~
|
49
|
+
<<~CODE,
|
50
50
|
class { 'example2':
|
51
51
|
param1 => 'value1',
|
52
52
|
|
53
53
|
param2 => 'value2',
|
54
54
|
}
|
55
|
-
|
55
|
+
CODE
|
56
56
|
)
|
57
57
|
end
|
58
58
|
end
|
@@ -11,11 +11,11 @@ describe 'manifest_whitespace_missing_newline_end_of_file' do
|
|
11
11
|
'class example { }'
|
12
12
|
end
|
13
13
|
|
14
|
-
it '
|
14
|
+
it 'detects a single problem' do
|
15
15
|
expect(problems).to have(1).problem
|
16
16
|
end
|
17
17
|
|
18
|
-
it '
|
18
|
+
it 'creates a error' do
|
19
19
|
expect(problems).to contain_error(single_newline_end_of_file_msg).on_line(1).in_column(17)
|
20
20
|
end
|
21
21
|
end
|
@@ -35,15 +35,15 @@ describe 'manifest_whitespace_missing_newline_end_of_file' do
|
|
35
35
|
'class example { }'
|
36
36
|
end
|
37
37
|
|
38
|
-
it '
|
38
|
+
it 'detects a single problem' do
|
39
39
|
expect(problems).to have(1).problem
|
40
40
|
end
|
41
41
|
|
42
|
-
it '
|
42
|
+
it 'fixes the manifest' do
|
43
43
|
expect(problems).to contain_fixed(single_newline_end_of_file_msg).on_line(1).in_column(17)
|
44
44
|
end
|
45
45
|
|
46
|
-
it '
|
46
|
+
it 'adds the final newline' do
|
47
47
|
expect(manifest).to eq("class example { }\n")
|
48
48
|
end
|
49
49
|
end
|
@@ -7,7 +7,7 @@ describe 'manifest_whitespace_newline_beginning_of_file' do
|
|
7
7
|
|
8
8
|
context 'with good example' do
|
9
9
|
let(:code) do
|
10
|
-
<<~
|
10
|
+
<<~CODE
|
11
11
|
class example (
|
12
12
|
|
13
13
|
|
@@ -16,10 +16,10 @@ describe 'manifest_whitespace_newline_beginning_of_file' do
|
|
16
16
|
|
17
17
|
|
18
18
|
}
|
19
|
-
|
19
|
+
CODE
|
20
20
|
end
|
21
21
|
|
22
|
-
it '
|
22
|
+
it 'does not detect any problems' do
|
23
23
|
expect(problems).to be_empty
|
24
24
|
end
|
25
25
|
end
|
@@ -27,38 +27,38 @@ describe 'manifest_whitespace_newline_beginning_of_file' do
|
|
27
27
|
context 'with fix disabled' do
|
28
28
|
context 'with 1 empty line at the beginning of a manifest' do
|
29
29
|
let(:code) do
|
30
|
-
<<~
|
30
|
+
<<~CODE
|
31
31
|
|
32
32
|
class example {
|
33
33
|
}
|
34
|
-
|
34
|
+
CODE
|
35
35
|
end
|
36
36
|
|
37
|
-
it '
|
37
|
+
it 'detects a single problem' do
|
38
38
|
expect(problems).to have(1).problem
|
39
39
|
end
|
40
40
|
|
41
|
-
it '
|
41
|
+
it 'creates a error' do
|
42
42
|
expect(problems).to contain_error(single_beginning_of_file_msg).on_line(1).in_column(1)
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
46
|
context 'with 3 empty lines at the beginning of a manifest' do
|
47
47
|
let(:code) do
|
48
|
-
<<~
|
48
|
+
<<~CODE
|
49
49
|
|
50
50
|
|
51
51
|
|
52
52
|
class example {
|
53
53
|
}
|
54
|
-
|
54
|
+
CODE
|
55
55
|
end
|
56
56
|
|
57
|
-
it '
|
57
|
+
it 'detects 3 problems' do
|
58
58
|
expect(problems).to have(3).problem
|
59
59
|
end
|
60
60
|
|
61
|
-
it '
|
61
|
+
it 'creates a error' do
|
62
62
|
expect(problems).to contain_error(single_beginning_of_file_msg).on_line(1).in_column(1)
|
63
63
|
expect(problems).to contain_error(single_beginning_of_file_msg).on_line(2).in_column(1)
|
64
64
|
expect(problems).to contain_error(single_beginning_of_file_msg).on_line(3).in_column(1)
|
@@ -77,58 +77,58 @@ describe 'manifest_whitespace_newline_beginning_of_file' do
|
|
77
77
|
|
78
78
|
context 'with 1 empty line at the beginning of a manifest' do
|
79
79
|
let(:code) do
|
80
|
-
<<~
|
80
|
+
<<~CODE
|
81
81
|
|
82
82
|
class example {
|
83
83
|
}
|
84
|
-
|
84
|
+
CODE
|
85
85
|
end
|
86
86
|
|
87
|
-
it '
|
87
|
+
it 'detects a single problem' do
|
88
88
|
expect(problems).to have(1).problem
|
89
89
|
end
|
90
90
|
|
91
|
-
it '
|
91
|
+
it 'fixes the manifest' do
|
92
92
|
expect(problems).to contain_fixed(single_beginning_of_file_msg).on_line(1).in_column(1)
|
93
93
|
end
|
94
94
|
|
95
|
-
it '
|
95
|
+
it 'adds the final newline' do
|
96
96
|
expect(manifest).to eq(
|
97
|
-
<<~
|
97
|
+
<<~CODE,
|
98
98
|
class example {
|
99
99
|
}
|
100
|
-
|
100
|
+
CODE
|
101
101
|
)
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
105
105
|
context 'with 3 empty lines at the beginning of a manifest' do
|
106
106
|
let(:code) do
|
107
|
-
<<~
|
107
|
+
<<~CODE
|
108
108
|
|
109
109
|
|
110
110
|
|
111
111
|
class example {
|
112
112
|
}
|
113
|
-
|
113
|
+
CODE
|
114
114
|
end
|
115
115
|
|
116
|
-
it '
|
116
|
+
it 'detects 3 problem' do
|
117
117
|
expect(problems).to have(3).problem
|
118
118
|
end
|
119
119
|
|
120
|
-
it '
|
120
|
+
it 'fixes the manifest' do
|
121
121
|
expect(problems).to contain_fixed(single_beginning_of_file_msg).on_line(1).in_column(1)
|
122
122
|
expect(problems).to contain_fixed(single_beginning_of_file_msg).on_line(2).in_column(1)
|
123
123
|
expect(problems).to contain_fixed(single_beginning_of_file_msg).on_line(3).in_column(1)
|
124
124
|
end
|
125
125
|
|
126
|
-
it '
|
126
|
+
it 'adds the final newline' do
|
127
127
|
expect(manifest).to eq(
|
128
|
-
<<~
|
128
|
+
<<~CODE,
|
129
129
|
class example {
|
130
130
|
}
|
131
|
-
|
131
|
+
CODE
|
132
132
|
)
|
133
133
|
end
|
134
134
|
end
|