Skip to content

Commit f140c82

Browse files
committed
Layout/SpaceInsideHashLiteralBraces
This commit enables the Rubocop Layout/SpaceInsideHashLiteralBraces cop and addresses all offenses.
1 parent 735ec34 commit f140c82

File tree

142 files changed

+423
-430
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

142 files changed

+423
-430
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +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, EnforcedStyleForEmptyBraces.
27-
# SupportedStyles: space, no_space, compact
28-
# SupportedStylesForEmptyBraces: space, no_space
29-
Layout/SpaceInsideHashLiteralBraces:
30-
Enabled: false
31-
3225
# This cop supports safe auto-correction (--auto-correct).
3326
# Configuration parameters: EnforcedStyle.
3427
# SupportedStyles: space, compact, no_space

lib/puppet/agent.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,13 @@ def run(client_options = {})
9999
nil
100100
else
101101
Puppet.info _("Another puppet instance is already running; --waitforlock flag used, waiting for running instance to finish.")
102-
Puppet.info _("Will try again in %{time} seconds.") % {time: Puppet[:waitforlock]}
102+
Puppet.info _("Will try again in %{time} seconds.") % { time: Puppet[:waitforlock] }
103103
sleep Puppet[:waitforlock]
104104
retry
105105
end
106106
rescue RunTimeoutError => detail
107107
Puppet.log_exception(detail, _("Execution of %{client_class} did not complete within %{runtimeout} seconds and was terminated.") %
108-
{client_class: client_class, runtimeout: Puppet[:runtimeout]})
108+
{ client_class: client_class, runtimeout: Puppet[:runtimeout] })
109109
nil
110110
rescue StandardError => detail
111111
Puppet.log_exception(detail, _("Could not run %{client_class}: %{detail}") % { client_class: client_class, detail: detail })

lib/puppet/application/agent.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,13 +426,13 @@ def fingerprint
426426
end
427427
end
428428
rescue => e
429-
Puppet.log_exception(e, _("Failed to generate fingerprint: %{message}") % {message: e.message})
429+
Puppet.log_exception(e, _("Failed to generate fingerprint: %{message}") % { message: e.message })
430430
exit(1)
431431
end
432432

433433
def onetime(daemon)
434434
begin
435-
exitstatus = daemon.agent.run({:job_id => options[:job_id], :start_time => options[:start_time], :waitforcert => options[:waitforcert]})
435+
exitstatus = daemon.agent.run({ :job_id => options[:job_id], :start_time => options[:start_time], :waitforcert => options[:waitforcert] })
436436
rescue => detail
437437
Puppet.log_exception(detail)
438438
end

lib/puppet/application/apply.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def main
213213
# rubocop:enable Layout/ExtraSpacing
214214

215215
# TRANSLATORS "puppet apply" is a program command and should not be translated
216-
Puppet.override({:current_environment => apply_environment, :loaders => create_loaders(apply_environment)}, _("For puppet apply")) do
216+
Puppet.override({ :current_environment => apply_environment, :loaders => create_loaders(apply_environment) }, _("For puppet apply")) do
217217
configure_node_facts(node, facts)
218218

219219
# Allow users to load the classes that puppet agent creates.
@@ -340,7 +340,7 @@ def read_catalog(text)
340340
configured_environment = get_configured_environment(node)
341341

342342
# TRANSLATORS "puppet apply" is a program command and should not be translated
343-
Puppet.override({:current_environment => configured_environment}, _("For puppet apply")) do
343+
Puppet.override({ :current_environment => configured_environment }, _("For puppet apply")) do
344344
configure_node_facts(node, facts)
345345

346346
# NOTE: Does not set rich_data = true automatically (which would ensure always reading catalog with rich data

lib/puppet/application/doc.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class Puppet::Application::Doc < Puppet::Application
88
attr_accessor :unknown_args, :manifest
99

1010
def preinit
11-
{:references => [], :mode => :text, :format => :to_markdown }.each do |name, value|
11+
{ :references => [], :mode => :text, :format => :to_markdown }.each do |name, value|
1212
options[name] = value
1313
end
1414
@unknown_args = []
@@ -117,7 +117,7 @@ module - see https://github.com/puppetlabs/puppetlabs-strings for more informati
117117
end
118118

119119
def handle_unknown( opt, arg )
120-
@unknown_args << {:opt => opt, :arg => arg }
120+
@unknown_args << { :opt => opt, :arg => arg }
121121
true
122122
end
123123

lib/puppet/application/lookup.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -288,16 +288,16 @@ def main
288288
end
289289

290290
if merge == 'deep'
291-
merge_options = {'strategy' => 'deep',
292-
'sort_merged_arrays' => !options[:sort_merged_arrays].nil?,
293-
'merge_hash_arrays' => !options[:merge_hash_arrays].nil?}
291+
merge_options = { 'strategy' => 'deep',
292+
'sort_merged_arrays' => !options[:sort_merged_arrays].nil?,
293+
'merge_hash_arrays' => !options[:merge_hash_arrays].nil? }
294294

295295
if options[:prefix]
296296
merge_options['knockout_prefix'] = options[:prefix]
297297
end
298298

299299
else
300-
merge_options = {'strategy' => merge}
300+
merge_options = { 'strategy' => merge }
301301
end
302302
end
303303

@@ -364,7 +364,7 @@ def generate_scope
364364
if TRUSTED_INFORMATION_FACTS.any? { |key| given_facts.key? key }
365365
unless TRUSTED_INFORMATION_FACTS.all? { |key| given_facts.key? key }
366366
raise _("When overriding any of the %{trusted_facts_list} facts with %{fact_file} "\
367-
"given via the --facts flag, they must all be overridden.") % { fact_file: fact_file, trusted_facts_list: TRUSTED_INFORMATION_FACTS.join(',')}
367+
"given via the --facts flag, they must all be overridden.") % { fact_file: fact_file, trusted_facts_list: TRUSTED_INFORMATION_FACTS.join(',') }
368368
end
369369
end
370370
end
@@ -421,7 +421,7 @@ def retrieve_node_facts(node, given_facts)
421421
facts.add_extra_values(given_facts) if given_facts
422422

423423
if facts.values.empty?
424-
raise _("No facts available for target node: %{node}") % { node: node}
424+
raise _("No facts available for target node: %{node}") % { node: node }
425425
end
426426

427427
facts

lib/puppet/application/script.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def main
169169
node.environment = apply_environment
170170

171171
# TRANSLATION, the string "For puppet script" is not user facing
172-
Puppet.override({:current_environment => apply_environment}, "For puppet script") do
172+
Puppet.override({ :current_environment => apply_environment }, "For puppet script") do
173173
# Merge in the facts.
174174
node.merge(facts.values) if facts
175175

lib/puppet/application/ssl.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def main
149149
when 'clean'
150150
possible_extra_args = command_line.args.drop(1)
151151
unless possible_extra_args.empty?
152-
raise Puppet::Error, _(<<~END) % { args: possible_extra_args.join(' ')}
152+
raise Puppet::Error, _(<<~END) % { args: possible_extra_args.join(' ') }
153153
Extra arguments detected: %{args}
154154
Did you mean to run:
155155
puppetserver ca clean --certname <name>

lib/puppet/application_support.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def self.push_application_context(run_mode, environment_mode = :local)
3737
configured_environment = configured_environment.override_from_commandline(Puppet.settings)
3838

3939
# Setup a new context using the app's configuration
40-
Puppet.push_context({:current_environment => configured_environment},
40+
Puppet.push_context({ :current_environment => configured_environment },
4141
"Update current environment from application's configuration")
4242
end
4343

lib/puppet/configurer.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def check_payload_size(payload)
186186
return if max_size.zero?
187187

188188
warn_fact_payload_size(payload, max_size) if payload > max_size
189-
Puppet.debug _("The size of the payload is %{payload}") % {payload: payload}
189+
Puppet.debug _("The size of the payload is %{payload}") % { payload: payload }
190190
end
191191

192192
def parse_fact_name_and_value_limits(object, path = [])
@@ -216,7 +216,7 @@ def check_facts_limits(facts)
216216

217217
parse_fact_name_and_value_limits(facts)
218218
check_total_number_limit(@number_of_facts)
219-
Puppet.debug _("The total number of facts registered is %{number_of_facts}") % {number_of_facts: @number_of_facts}
219+
Puppet.debug _("The total number of facts registered is %{number_of_facts}") % { number_of_facts: @number_of_facts }
220220
end
221221

222222
def get_facts(options)
@@ -273,7 +273,7 @@ def prepare_and_retrieve_catalog(cached_catalog, facts, options, query_options)
273273
end
274274

275275
def prepare_and_retrieve_catalog_from_cache(options = {})
276-
result = retrieve_catalog_from_cache({:transaction_uuid => @transaction_uuid, :static_catalog => @static_catalog})
276+
result = retrieve_catalog_from_cache({ :transaction_uuid => @transaction_uuid, :static_catalog => @static_catalog })
277277
Puppet.info _("Using cached catalog from environment '%{catalog_env}'") % { catalog_env: result.environment } if result
278278
result
279279
end
@@ -560,7 +560,7 @@ def find_functional_server
560560
{ host: e.response.url.host, port: e.response.url.port, code: e.response.code, reason: e.response.reason })
561561
rescue => detail
562562
# TRANSLATORS 'server_list' is the name of a setting and should not be translated
563-
Puppet.debug _("Unable to connect to server from server_list setting: %{detail}") % {detail: detail}
563+
Puppet.debug _("Unable to connect to server from server_list setting: %{detail}") % { detail: detail }
564564
end
565565
[nil, nil]
566566
end

0 commit comments

Comments
 (0)