Skip to content

Commit be0a720

Browse files
committed
(CONT-772) Correct cop group 1
1 parent 78ef5ef commit be0a720

17 files changed

+98
-139
lines changed

.rubocop_todo.yml

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,11 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2023-04-19 16:57:14 UTC using RuboCop version 1.48.1.
3+
# on 2023-04-19 17:41:01 UTC using RuboCop version 1.48.1.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
77
# versions of RuboCop, may require this file to be generated again.
88

9-
# Offense count: 5
10-
# This cop supports safe autocorrection (--autocorrect).
11-
Layout/ClosingHeredocIndentation:
12-
Exclude:
13-
- 'spec/acceptance/itk_spec.rb'
14-
- 'spec/acceptance/mod_authnz_ldap_spec.rb'
15-
- 'spec/acceptance/vhost_spec.rb'
16-
17-
# Offense count: 8
18-
# This cop supports safe autocorrection (--autocorrect).
19-
Layout/EmptyLineAfterGuardClause:
20-
Exclude:
21-
- 'lib/puppet/functions/apache/bool2httpd.rb'
22-
- 'spec/classes/mod/authnz_ldap_spec.rb'
23-
- 'spec/spec_helper_acceptance_local.rb'
24-
- 'tasks/init.rb'
25-
- 'util/apache_mod_platform_support.rb'
26-
27-
# Offense count: 2
28-
# This cop supports safe autocorrection (--autocorrect).
29-
Layout/HeredocIndentation:
30-
Exclude:
31-
- 'spec/classes/mod/http2_spec.rb'
32-
33-
# Offense count: 15
34-
# This cop supports safe autocorrection (--autocorrect).
35-
# Configuration parameters: EnforcedStyle.
36-
# SupportedStyles: leading, trailing
37-
Layout/LineContinuationLeadingSpace:
38-
Exclude:
39-
- 'spec/classes/mod/info_spec.rb'
40-
- 'spec/classes/mod/jk_spec.rb'
41-
- 'spec/classes/mod/proxy_balancer_spec.rb'
42-
- 'spec/classes/mod/status_spec.rb'
43-
- 'spec/util/apache_mod_platform_compatibility_spec.rb'
44-
45-
# Offense count: 52
46-
# This cop supports safe autocorrection (--autocorrect).
47-
# Configuration parameters: AutoCorrect, EnforcedStyle.
48-
# SupportedStyles: space, no_space
49-
Layout/LineContinuationSpacing:
50-
Exclude:
51-
- 'spec/classes/mod/deflate_spec.rb'
52-
- 'spec/classes/mod/info_spec.rb'
53-
- 'spec/classes/mod/jk_spec.rb'
54-
- 'spec/classes/mod/ldap_spec.rb'
55-
- 'spec/classes/mod/proxy_balancer_spec.rb'
56-
- 'spec/classes/mod/status_spec.rb'
57-
589
# Offense count: 4
5910
# This cop supports safe autocorrection (--autocorrect).
6011
# Configuration parameters: EnforcedStyle, IndentationWidth.

lib/puppet/functions/apache/bool2httpd.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
def bool2httpd(arg)
2222
return 'Off' if arg.nil? || arg == false || matches_string?(arg, %r{false}i) || arg == :undef
2323
return 'On' if arg == true || matches_string?(arg, %r{true}i)
24+
2425
arg.to_s
2526
end
2627

spec/acceptance/itk_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ class { 'apache':
2828
mpm_module => 'prefork',
2929
}
3030
class { 'apache::mod::itk': }
31-
MANIFEST
31+
MANIFEST
3232
when :itk_only
3333
<<-MANIFEST
3434
class { 'apache':
3535
mpm_module => 'itk',
3636
}
37-
MANIFEST
37+
MANIFEST
3838
end
3939
end
4040

spec/acceptance/mod_authnz_ldap_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
}
1919
class { 'apache': }
2020
class { 'apache::mod::authnz_ldap': }
21-
MANIFEST
21+
MANIFEST
2222
else
2323
<<-MANIFEST
2424
class { 'apache': }
2525
class { 'apache::mod::authnz_ldap': }
26-
MANIFEST
26+
MANIFEST
2727
end
2828

2929
it 'succeeds in installing the mod_authnz_ldap module' do

spec/acceptance/vhost_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ class { 'apache': }
299299
content => "Hello World\\n",
300300
}
301301
host { 'files.example.net': ip => '127.0.0.1', }
302-
MANIFEST
302+
MANIFEST
303303
end
304304

305305
describe 'readme example, adapted' do

spec/classes/mod/authnz_ldap_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
context 'default configuration with parameters on a RedHat OS' do
3535
on_supported_os.each do |os, os_facts|
3636
next unless os.start_with?('redhat')
37+
3738
context "On #{os}" do
3839
let :facts do
3940
os_facts

spec/classes/mod/deflate_spec.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
def general_deflate_specs
77
it { is_expected.to contain_apache__mod('deflate') }
88

9-
expected = "AddOutputFilterByType DEFLATE application/rss+xml\n"\
10-
"AddOutputFilterByType DEFLATE application/x-javascript\n"\
11-
"AddOutputFilterByType DEFLATE text/css\n"\
12-
"AddOutputFilterByType DEFLATE text/html\n"\
13-
"\n"\
14-
"DeflateFilterNote Input instream\n"\
15-
"DeflateFilterNote Output outstream\n"\
9+
expected = "AddOutputFilterByType DEFLATE application/rss+xml\n" \
10+
"AddOutputFilterByType DEFLATE application/x-javascript\n" \
11+
"AddOutputFilterByType DEFLATE text/css\n" \
12+
"AddOutputFilterByType DEFLATE text/html\n" \
13+
"\n" \
14+
"DeflateFilterNote Input instream\n" \
15+
"DeflateFilterNote Output outstream\n" \
1616
"DeflateFilterNote Ratio ratio\n"
1717

1818
it do

spec/classes/mod/http2_spec.rb

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
it { is_expected.to contain_class('apache::mod::http2') }
1212
context 'with default values' do
1313
let(:expected_content) do
14-
<<EOT
15-
# The http2 Apache module configuration file is being
16-
# managed by Puppet and changes will be overwritten.
14+
<<~EOT
15+
# The http2 Apache module configuration file is being
16+
# managed by Puppet and changes will be overwritten.
1717
18-
EOT
18+
EOT
1919
end
2020

2121
it { is_expected.to contain_file('http2.conf').with(content: expected_content) }
@@ -53,32 +53,32 @@
5353
end
5454

5555
let(:expected_content) do
56-
<<EOT
57-
# The http2 Apache module configuration file is being
58-
# managed by Puppet and changes will be overwritten.
56+
<<~EOT
57+
# The http2 Apache module configuration file is being
58+
# managed by Puppet and changes will be overwritten.
5959
60-
H2CopyFiles Off
61-
H2Direct On
62-
H2EarlyHints Off
63-
H2MaxSessionStreams 100
64-
H2MaxWorkerIdleSeconds 600
65-
H2MaxWorkers 20
66-
H2MinWorkers 10
67-
H2ModernTLSOnly On
68-
H2Push On
69-
H2PushDiarySize 256
70-
H2PushPriority application/json 32
71-
H2PushPriority image/jpeg before
72-
H2PushPriority text/css interleaved
73-
H2PushResource /xxx.css
74-
H2PushResource /xxx.js
75-
H2SerializeHeaders On
76-
H2StreamMaxMemSize 128000
77-
H2TLSCoolDownSecs 0
78-
H2TLSWarmUpSize 0
79-
H2Upgrade Off
80-
H2WindowSize 128000
81-
EOT
60+
H2CopyFiles Off
61+
H2Direct On
62+
H2EarlyHints Off
63+
H2MaxSessionStreams 100
64+
H2MaxWorkerIdleSeconds 600
65+
H2MaxWorkers 20
66+
H2MinWorkers 10
67+
H2ModernTLSOnly On
68+
H2Push On
69+
H2PushDiarySize 256
70+
H2PushPriority application/json 32
71+
H2PushPriority image/jpeg before
72+
H2PushPriority text/css interleaved
73+
H2PushResource /xxx.css
74+
H2PushResource /xxx.js
75+
H2SerializeHeaders On
76+
H2StreamMaxMemSize 128000
77+
H2TLSCoolDownSecs 0
78+
H2TLSWarmUpSize 0
79+
H2Upgrade Off
80+
H2WindowSize 128000
81+
EOT
8282
end
8383

8484
it { is_expected.to contain_file('http2.conf').with(content: expected_content) }

spec/classes/mod/info_spec.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ def general_info_specs_apache24
66
it { is_expected.to contain_apache__mod('info') }
77

88
context 'passing no parameters' do
9-
expected = "<Location /server-info>\n"\
10-
" SetHandler server-info\n"\
11-
" Require ip 127.0.0.1 ::1\n"\
9+
expected = "<Location /server-info>\n " \
10+
"SetHandler server-info\n " \
11+
"Require ip 127.0.0.1 ::1\n" \
1212
"</Location>\n"
1313
it { is_expected.to contain_file('info.conf').with_content(expected) }
1414
end
@@ -21,8 +21,8 @@ def general_info_specs_apache24
2121

2222
it {
2323
is_expected.to contain_file('info.conf').with_content(
24-
"<Location /server-info>\n"\
25-
" SetHandler server-info\n"\
24+
"<Location /server-info>\n " \
25+
"SetHandler server-info\n" \
2626
"</Location>\n",
2727
)
2828
}
@@ -32,9 +32,9 @@ def general_info_specs_apache24
3232
{ allow_from: ['10.10.1.2', '192.168.1.2', '127.0.0.1'] }
3333
end
3434

35-
expected = "<Location /server-info>\n"\
36-
" SetHandler server-info\n"\
37-
" Require ip 10.10.1.2 192.168.1.2 127.0.0.1\n"\
35+
expected = "<Location /server-info>\n " \
36+
"SetHandler server-info\n " \
37+
"Require ip 10.10.1.2 192.168.1.2 127.0.0.1\n" \
3838
"</Location>\n"
3939
it {
4040
is_expected.to contain_file('info.conf').with_content(expected)
@@ -50,8 +50,8 @@ def general_info_specs_apache24
5050

5151
it {
5252
is_expected.to contain_file('info.conf').with_content(
53-
"<Location /server-info>\n"\
54-
" SetHandler server-info\n"\
53+
"<Location /server-info>\n " \
54+
"SetHandler server-info\n" \
5555
"</Location>\n",
5656
)
5757
}

spec/classes/mod/jk_spec.rb

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,19 @@
4141

4242
it { is_expected.to compile }
4343
it { is_expected.to compile.with_all_deps }
44-
expected_content = "# This file is generated automatically by Puppet - DO NOT EDIT\n"\
45-
"# Any manual changes will be overwritten\n"\
46-
"\n"\
47-
"worker.list = worker_a,worker_b\n"\
48-
"\n"\
49-
"worker.maintain = 40\n"\
50-
"\n"\
51-
"# This is worker A\n"\
52-
"worker.worker_a.socket_keepalive=true\n"\
53-
"worker.worker_a.type=ajp13\n"\
54-
"\n"\
55-
"# This is worker B\n"\
56-
"worker.worker_b.socket_keepalive=true\n"\
44+
expected_content = "# This file is generated automatically by Puppet - DO NOT EDIT\n" \
45+
"# Any manual changes will be overwritten\n" \
46+
"\n" \
47+
"worker.list = worker_a,worker_b\n" \
48+
"\n" \
49+
"worker.maintain = 40\n" \
50+
"\n" \
51+
"# This is worker A\n" \
52+
"worker.worker_a.socket_keepalive=true\n" \
53+
"worker.worker_a.type=ajp13\n" \
54+
"\n" \
55+
"# This is worker B\n" \
56+
"worker.worker_b.socket_keepalive=true\n" \
5757
"worker.worker_b.type=ajp13\n"
5858
it { is_expected.to contain_file("#{mod_dir}/workers.properties").with_content(expected_content) }
5959
end
@@ -169,12 +169,12 @@
169169
)
170170
end
171171

172-
expected = "# This file is generated automatically by Puppet - DO NOT EDIT\n"\
173-
"# Any manual changes will be overwritten\n"\
174-
"\n"\
175-
"<IfModule jk_module>\n"\
176-
" JkShmFile #{paths[:shm_path]}\n"\
177-
" JkLogFile #{paths[:log_path]}\n"\
172+
expected = "# This file is generated automatically by Puppet - DO NOT EDIT\n" \
173+
"# Any manual changes will be overwritten\n" \
174+
"\n" \
175+
"<IfModule jk_module>\n " \
176+
"JkShmFile #{paths[:shm_path]}\n " \
177+
"JkLogFile #{paths[:log_path]}\n" \
178178
"</IfModule>\n"
179179
it { is_expected.to contain_file('jk.conf').with_content(expected) }
180180
end

spec/classes/mod/ldap_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@
4646
it { is_expected.to contain_file('ldap.conf').with_content(%r{^LDAPOpCacheTTL 600$}) }
4747

4848
expected_ldap_path_re =
49-
"<Location /custom-ldap-status>\n"\
50-
"\s*SetHandler ldap-status\n"\
51-
".*\n"\
49+
"<Location /custom-ldap-status>\n" \
50+
"\s*SetHandler ldap-status\n" \
51+
".*\n" \
5252
"</Location>\n"
5353
it { is_expected.to contain_file('ldap.conf').with_content(%r{#{expected_ldap_path_re}}m) }
5454
end

spec/classes/mod/proxy_balancer_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
# Helper function for testing the contents of `proxy_balancer.conf`
66
def balancer_manager_conf_spec(allow_from, manager_path)
7-
expected = "<Location #{manager_path}>\n"\
8-
" SetHandler balancer-manager\n"\
9-
" Require ip #{Array(allow_from).join(' ')}\n"\
7+
expected = "<Location #{manager_path}>\n " \
8+
"SetHandler balancer-manager\n " \
9+
"Require ip #{Array(allow_from).join(' ')}\n" \
1010
"</Location>\n"
1111
it do
1212
is_expected.to contain_file('proxy_balancer.conf').with_content(expected)

spec/classes/mod/status_spec.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def require_directives(requires)
1515
requires.map { |req| " Require #{req}\n" }.join('')
1616
elsif requires.is_a?(Hash)
1717
if requires.key?(:enforce)
18-
\
18+
\
1919
" <Require#{requires[:enforce].capitalize}>\n" + \
2020
requires[:requires].map { |req| " Require #{req}\n" }.join('') + \
2121
" </Require#{requires[:enforce].capitalize}>\n"
@@ -27,15 +27,15 @@ def require_directives(requires)
2727

2828
shared_examples 'status_conf_spec_require' do |requires, extended_status, status_path|
2929
expected =
30-
"<Location #{status_path}>\n"\
31-
" SetHandler server-status\n"\
32-
"#{require_directives(requires)}"\
33-
"</Location>\n"\
34-
"ExtendedStatus #{extended_status}\n"\
35-
"\n"\
36-
"<IfModule mod_proxy.c>\n"\
37-
" # Show Proxy LoadBalancer status in mod_status\n"\
38-
" ProxyStatus On\n"\
30+
"<Location #{status_path}>\n " \
31+
"SetHandler server-status\n" \
32+
"#{require_directives(requires)}" \
33+
"</Location>\n" \
34+
"ExtendedStatus #{extended_status}\n" \
35+
"\n" \
36+
"<IfModule mod_proxy.c>\n " \
37+
"# Show Proxy LoadBalancer status in mod_status\n " \
38+
"ProxyStatus On\n" \
3939
"</IfModule>\n"
4040
it('status conf require') do
4141
is_expected.to contain_file('status.conf').with_content(expected)

spec/spec_helper_acceptance_local.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,5 +151,6 @@ def apache_settings_hash
151151

152152
def mod_supported_on_platform?(mod)
153153
return false if ENV['DISABLE_MOD_TEST_EXCLUSION']
154+
154155
ApacheModTestFilterHelper.instance.mod_supported_on_platform?(mod)
155156
end

spec/util/apache_mod_platform_compatibility_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,9 @@
162162

163163
tag_format_help_msg_txt = ['succint', 'warning']
164164

165-
expected_stderr_msg = "The following errors were encountered when trying to parse the 'Unsupported platforms' tag(s) in 'manifests/mod':\n" \
166-
" * #{abc_pp} (line #{abc_pp_error_line}): #{abc_pp_error_type_msg} #{abc_pp_error_detail}\n" \
167-
" * #{def_pp} (line #{def_pp_error_line}): #{def_pp_error_type_msg} #{def_pp_error_detail}\n" \
165+
expected_stderr_msg = "The following errors were encountered when trying to parse the 'Unsupported platforms' tag(s) in 'manifests/mod':\n " \
166+
"* #{abc_pp} (line #{abc_pp_error_line}): #{abc_pp_error_type_msg} #{abc_pp_error_detail}\n " \
167+
"* #{def_pp} (line #{def_pp_error_line}): #{def_pp_error_type_msg} #{def_pp_error_detail}\n" \
168168
"#{tag_format_help_msg_txt[0]}\n" \
169169
"#{tag_format_help_msg_txt[1]}\n"
170170

0 commit comments

Comments
 (0)