Skip to content

Commit f443228

Browse files
committed
(CONT-772) Correct cop group 3
1 parent d39da27 commit f443228

File tree

7 files changed

+15
-60
lines changed

7 files changed

+15
-60
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -97,20 +97,6 @@ RSpec/FilePath:
9797
RSpec/ImplicitSubject:
9898
Enabled: false
9999

100-
# Offense count: 16
101-
# This cop supports safe autocorrection (--autocorrect).
102-
RSpec/LetBeforeExamples:
103-
Exclude:
104-
- 'spec/classes/mod/auth_kerb_spec.rb'
105-
- 'spec/classes/mod/auth_openidc_spec.rb'
106-
- 'spec/classes/mod/cluster_spec.rb'
107-
- 'spec/classes/mod/disk_cache_spec.rb'
108-
- 'spec/classes/mod/jk_spec.rb'
109-
- 'spec/classes/mod/proxy_balancer_spec.rb'
110-
- 'spec/classes/mod/ssl_spec.rb'
111-
- 'spec/classes/mod/wsgi_spec.rb'
112-
- 'spec/classes/service_spec.rb'
113-
114100
# Offense count: 17
115101
RSpec/MultipleExpectations:
116102
Max: 8
@@ -217,40 +203,9 @@ Style/RedundantRegexpEscape:
217203
- 'spec/classes/mod/wsgi_spec.rb'
218204
- 'spec/defines/vhost_spec.rb'
219205

220-
# Offense count: 22
221-
# This cop supports safe autocorrection (--autocorrect).
222-
Style/RedundantStringEscape:
223-
Exclude:
224-
- 'spec/acceptance/apache_parameters_spec.rb'
225-
- 'spec/acceptance/vhost_spec.rb'
226-
- 'spec/classes/mod/auth_mellon_spec.rb'
227-
- 'spec/defines/vhost_spec.rb'
228-
229-
# Offense count: 1
230-
# This cop supports safe autocorrection (--autocorrect).
231-
# Configuration parameters: EnforcedStyle.
232-
# SupportedStyles: implicit, explicit
233-
Style/RescueStandardError:
234-
Exclude:
235-
- 'spec/spec_helper.rb'
236-
237-
# Offense count: 3
238-
# This cop supports safe autocorrection (--autocorrect).
239-
Style/StderrPuts:
240-
Exclude:
241-
- 'util/apache_mod_platform_support.rb'
242-
243206
# Offense count: 1
244207
# This cop supports unsafe autocorrection (--autocorrect-all).
245208
# Configuration parameters: Mode.
246209
Style/StringConcatenation:
247210
Exclude:
248211
- 'lib/puppet/functions/apache/pw_hash.rb'
249-
250-
# Offense count: 1
251-
# This cop supports safe autocorrection (--autocorrect).
252-
# Configuration parameters: EnforcedStyle, AllowSafeAssignment.
253-
# SupportedStyles: require_parentheses, require_no_parentheses, require_parentheses_when_complex
254-
Style/TernaryParentheses:
255-
Exclude:
256-
- 'spec/defines/vhost_spec.rb'

spec/acceptance/apache_parameters_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,8 @@ class { 'apache':
367367
pp = <<-MANIFEST
368368
class { 'apache':
369369
log_formats => {
370-
'vhost_common' => '%v %h %l %u %t \\\"%r\\\" %>s %b',
371-
'vhost_combined' => '%v %h %l %u %t \\\"%r\\\" %>s %b \\\"%{Referer}i\\\" \\\"%{User-agent}i\\\"',
370+
'vhost_common' => '%v %h %l %u %t \\"%r\\" %>s %b',
371+
'vhost_combined' => '%v %h %l %u %t \\"%r\\" %>s %b \\"%{Referer}i\\" \\"%{User-agent}i\\"',
372372
}
373373
}
374374
MANIFEST

spec/acceptance/vhost_spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ class { 'apache': }
125125
it { is_expected.to contain 'ProxyPreserveHost On' }
126126
it { is_expected.to contain 'ProxyErrorOverride On' }
127127
it { is_expected.not_to contain 'ProxyAddHeaders' }
128-
it { is_expected.not_to contain "<Proxy \*>" }
128+
it { is_expected.not_to contain '<Proxy *>' }
129129
end
130130
end
131131

@@ -153,7 +153,7 @@ class { 'apache': }
153153
it { is_expected.to contain 'ProxyPreserveHost On' }
154154
it { is_expected.to contain 'ProxyErrorOverride On' }
155155
it { is_expected.not_to contain 'ProxyAddHeaders' }
156-
it { is_expected.not_to contain "<Proxy \*>" }
156+
it { is_expected.not_to contain '<Proxy *>' }
157157
end
158158
end
159159

@@ -276,9 +276,9 @@ class { 'apache':
276276
class { 'apache': }
277277
278278
if versioncmp('#{apache_hash['version']}', '2.4') >= 0 {
279-
$_files_match_directory = { 'path' => '(\.swp|\.bak|~)$', 'provider' => 'filesmatch', 'require' => 'all denied', }
279+
$_files_match_directory = { 'path' => '(.swp|.bak|~)$', 'provider' => 'filesmatch', 'require' => 'all denied', }
280280
} else {
281-
$_files_match_directory = { 'path' => '(\.swp|\.bak|~)$', 'provider' => 'filesmatch', 'deny' => 'from all', }
281+
$_files_match_directory = { 'path' => '(.swp|.bak|~)$', 'provider' => 'filesmatch', 'deny' => 'from all', }
282282
}
283283
284284
$_directories = [
@@ -785,14 +785,14 @@ class { 'apache': }
785785
apache::vhost { 'test.setenv_setenvif':
786786
docroot => '/tmp',
787787
setenv => ['TEST /test'],
788-
setenvif => ['Request_URI "\.gif$" object_is_image=gif']
788+
setenvif => ['Request_URI ".gif$" object_is_image=gif']
789789
}
790790
apache::vhost { 'test.rewrite':
791791
docroot => '/tmp',
792792
rewrites => [
793793
{ comment => 'test',
794794
rewrite_cond => '%{HTTP_USER_AGENT} ^Lynx/ [OR]',
795-
rewrite_rule => ['^index\.html$ welcome.html'],
795+
rewrite_rule => ['^index.html$ welcome.html'],
796796
rewrite_map => ['lc int:tolower'],
797797
}
798798
],

spec/classes/mod/auth_mellon_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
it { is_expected.to contain_apache__mod('auth_mellon') }
1414
it { is_expected.to contain_package('libapache2-mod-auth-mellon') }
1515
it { is_expected.to contain_file('auth_mellon.conf').with_path('/etc/apache2/mods-available/auth_mellon.conf') }
16-
it { is_expected.to contain_file('auth_mellon.conf').with_content("MellonPostDirectory \"\/var\/cache\/apache2\/mod_auth_mellon\/\"\n") }
16+
it { is_expected.to contain_file('auth_mellon.conf').with_content("MellonPostDirectory \"/var/cache/apache2/mod_auth_mellon/\"\n") }
1717
end
1818

1919
describe 'with parameters' do

spec/defines/vhost_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
describe 'apache::vhost', type: :define do
66
describe 'os-independent items' do
77
on_supported_os.each do |os, os_facts|
8-
let(:apache_name) { facts[:os]['family'] == 'RedHat' ? 'httpd' : 'apache2' }
8+
let(:apache_name) { (facts[:os]['family'] == 'RedHat') ? 'httpd' : 'apache2' }
99

1010
let :pre_condition do
1111
"class {'apache': default_vhost => false, default_mods => false, vhost_enable_dir => '/etc/#{apache_name}/sites-enabled'}"
@@ -2033,7 +2033,7 @@
20332033
let(:params) { super().merge(port: 84) }
20342034

20352035
context 'dest and regexp' do
2036-
let(:params) { super().merge(redirectmatch_dest: 'http://other.example.com$1.jpg', redirectmatch_regexp: "(.*)\.gif$") }
2036+
let(:params) { super().merge(redirectmatch_dest: 'http://other.example.com$1.jpg', redirectmatch_regexp: '(.*).gif$') }
20372037

20382038
it { is_expected.to contain_concat__fragment('rspec.example.com-redirect') }
20392039
it { is_expected.to contain_class('apache::mod::alias') }

spec/spec_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
begin
2828
default_facts.merge!(YAML.safe_load(File.read(f), [], [], true))
29-
rescue => e
29+
rescue StandardError => e
3030
RSpec.configuration.reporter.message "WARNING: Unable to load #{f}: #{e}"
3131
end
3232
end

util/apache_mod_platform_support.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ def initialize(manifest, line_num, error_type, error_detail)
6060
def print_parsing_errors
6161
return if @manifest_errors.empty?
6262

63-
$stderr.puts "The following errors were encountered when trying to parse the 'Unsupported platforms' tag(s) in 'manifests/mod':\n"
63+
warn "The following errors were encountered when trying to parse the 'Unsupported platforms' tag(s) in 'manifests/mod':\n"
6464
@manifest_errors.each do |manifest_error|
65-
$stderr.puts " * #{manifest_error.manifest} (line #{manifest_error.line_num}): #{ERROR_MSG[manifest_error.error_type]} #{manifest_error.error_detail}"
65+
warn " * #{manifest_error.manifest} (line #{manifest_error.line_num}): #{ERROR_MSG[manifest_error.error_type]} #{manifest_error.error_detail}"
6666
end
6767
File.readlines('util/_resources/tag_format_help_msg.txt').each do |line|
68-
$stderr.puts line
68+
warn line
6969
end
7070
end
7171

0 commit comments

Comments
 (0)