Skip to content

Commit b45783a

Browse files
committed
Layout/MultilineHashBraceLayout
This commit enables the Rubocop Layout/MultilineHashBraceLayout cop and addresses all offenses.
1 parent 6aac6b2 commit b45783a

File tree

10 files changed

+17
-32
lines changed

10 files changed

+17
-32
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,6 @@ I18n/GetText/DecorateStringFormattingUsingPercent:
2222
I18n/RailsI18n/DecorateString:
2323
Enabled: false
2424

25-
# This cop supports safe auto-correction (--auto-correct).
26-
# Configuration parameters: EnforcedStyle.
27-
# SupportedStyles: symmetrical, new_line, same_line
28-
Layout/MultilineHashBraceLayout:
29-
Exclude:
30-
- 'lib/puppet/configurer.rb'
31-
- 'lib/puppet/defaults.rb'
32-
- 'lib/puppet/face/facts.rb'
33-
- 'lib/puppet/file_serving/metadata.rb'
34-
- 'lib/puppet/indirector/catalog/compiler.rb'
35-
- 'lib/puppet/info_service/class_information_service.rb'
36-
- 'lib/puppet/pops/evaluator/evaluator_impl.rb'
37-
- 'lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb'
38-
- 'lib/puppet/pops/parser/lexer_support.rb'
39-
- 'lib/puppet/ssl/ssl_provider.rb'
40-
4125
# This cop supports safe auto-correction (--auto-correct).
4226
# Configuration parameters: EnforcedStyle.
4327
# SupportedStyles: symmetrical, new_line, same_line

lib/puppet/configurer.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,8 @@ def resubmit_facts
670670

671671
Puppet.info(_("Uploading facts for %{node} to %{server}") % {
672672
node: facts.name,
673-
server: puppet.url.hostname})
673+
server: puppet.url.hostname
674+
})
674675

675676
puppet.put_facts(facts.name, facts: facts, environment: Puppet.lookup(:current_environment).name.to_s)
676677

lib/puppet/face/facts.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@
7878

7979
Puppet.notice(_("Uploading facts for '%{node}' to '%{server}'") % {
8080
node: Puppet[:node_name_value],
81-
server: puppet.url.hostname})
81+
server: puppet.url.hostname
82+
})
8283

8384
puppet.put_facts(Puppet[:node_name_value], facts: facts, environment: Puppet.lookup(:current_environment).name.to_s)
8485
nil

lib/puppet/file_serving/metadata.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ def initialize(stat, path, source_permissions)
7878

7979
{ :owner => 'S-1-5-32-544',
8080
:group => 'S-1-0-0',
81-
:mode => 0644
82-
}.each do |method, default_value|
81+
:mode => 0644}.each do |method, default_value|
8382
define_method method do
8483
return default_value
8584
end

lib/puppet/indirector/catalog/compiler.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,8 +442,7 @@ def set_server_facts
442442
# And then add the server name and IP
443443
{"servername" => "networking.fqdn",
444444
"serverip" => "networking.ip",
445-
"serverip6" => "networking.ip6"
446-
}.each do |var, fact|
445+
"serverip6" => "networking.ip6"}.each do |var, fact|
447446
value = Puppet.runtime[:facter].value(fact)
448447
if !value.nil?
449448
@server_facts[var] = value

lib/puppet/info_service/class_information_service.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,8 @@ def parse_file(f)
6060
{:classes =>
6161
parse_result.definitions.select {|d| d.is_a?(Puppet::Pops::Model::HostClassDefinition)}.map do |d|
6262
{:name => d.name,
63-
:params => d.parameters.map {|p| extract_param(p) }
64-
}
65-
end
66-
}
63+
:params => d.parameters.map {|p| extract_param(p) }}
64+
end}
6765
rescue StandardError => e
6866
{:error => e.message }
6967
end

lib/puppet/pops/evaluator/evaluator_impl.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,8 @@ def eval_ComparisonExpression o, scope
572572
:operator => o.operator,
573573
:left_value => left,
574574
:right_value => right,
575-
:detail => e.message}, e)
575+
:detail => e.message
576+
}, e)
576577
end
577578
end
578579

lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ def self.create(loader, typed_name, source_ref, ruby_code_string)
4949

5050
unless func_info[:name] == "function_#{typed_name.name()}"
5151
raise ArgumentError, _("The code loaded from %{source_ref} produced mis-matched name, expected 'function_%{type_name}', got '%{created_name}'") % {
52-
source_ref: source_ref, type_name: typed_name.name, created_name: func_info[:name] }
52+
source_ref: source_ref, type_name: typed_name.name, created_name: func_info[:name]
53+
}
5354
end
5455
end
5556

lib/puppet/pops/parser/lexer_support.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,7 @@ def assert_not_bom(content)
198198
lex_error_without_pos(
199199
Puppet::Pops::Issues::ILLEGAL_BOM,
200200
{ :format_name => name,
201-
:bytes => "[#{bom.values[0,size].map {|b| "%X" % b}.join(" ")}]"
202-
})
201+
:bytes => "[#{bom.values[0,size].map {|b| "%X" % b}.join(" ")}]"})
203202
end
204203

205204
def get_bom(content)

lib/puppet/ssl/ssl_provider.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,8 @@ def raise_cert_verify_error(store_context, current_cert)
335335
_("Invalid signature for CRL issued by '%{issuer}'") % { issuer: issuer(current_cert) }
336336
when OpenSSL::X509::V_ERR_UNABLE_TO_GET_ISSUER_CERT
337337
_("The issuer '%{issuer}' of certificate '%{subject}' is missing") % {
338-
issuer: issuer(current_cert), subject: subject(current_cert) }
338+
issuer: issuer(current_cert), subject: subject(current_cert)
339+
}
339340
when OpenSSL::X509::V_ERR_UNABLE_TO_GET_CRL
340341
_("The CRL issued by '%{issuer}' is missing") % { issuer: issuer(current_cert) }
341342
when OpenSSL::X509::V_ERR_CERT_REVOKED
@@ -344,7 +345,8 @@ def raise_cert_verify_error(store_context, current_cert)
344345
# error_string is labeled ASCII-8BIT, but is encoded based on Encoding.default_external
345346
err_utf8 = Puppet::Util::CharacterEncoding.convert_to_utf_8(store_context.error_string)
346347
_("Certificate '%{subject}' failed verification (%{err}): %{err_utf8}") % {
347-
subject: subject(current_cert), err: store_context.error, err_utf8: err_utf8 }
348+
subject: subject(current_cert), err: store_context.error, err_utf8: err_utf8
349+
}
348350
end
349351

350352
raise Puppet::SSL::CertVerifyError.new(message, store_context.error, current_cert)

0 commit comments

Comments
 (0)