Skip to content

Commit 66d053b

Browse files
committed
Layout/EmptyLineAfterGuardClause
This commit enables the Rubocop Layout/EmptyLineAfterGuardClause cop and fixes all offenses.
1 parent 584abe3 commit 66d053b

File tree

324 files changed

+872
-4
lines changed

Some content is hidden

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

324 files changed

+872
-4
lines changed

.rubocop_todo.yml

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

25-
# This cop supports safe auto-correction (--auto-correct).
26-
Layout/EmptyLineAfterGuardClause:
27-
Enabled: false
28-
2925
# This cop supports safe auto-correction (--auto-correct).
3026
Layout/EmptyLineAfterMagicComment:
3127
Enabled: false

lib/puppet/agent/disabler.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def disable_message
4141
if data.has_key?(DISABLED_MESSAGE_JSON_KEY)
4242
return data[DISABLED_MESSAGE_JSON_KEY]
4343
end
44+
4445
nil
4546
end
4647

lib/puppet/application.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ def clear?
169169
# Thus, long-running background processes can potentially finish their work before a restart.
170170
def controlled_run(&block)
171171
return unless clear?
172+
172173
result = block.call
173174
Process.kill(:HUP, $PID) if restart_requested?
174175
result
@@ -303,6 +304,7 @@ def run_mode(mode_name = nil)
303304
# @api public
304305
def environment_mode(mode_name)
305306
raise Puppet::Error, _("Invalid environment mode '%{mode_name}'") % { mode_name: mode_name } unless [:local, :remote, :not_required].include?(mode_name)
307+
306308
@environment_mode = mode_name
307309
end
308310

lib/puppet/application/agent.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ def log_config
404404

405405
Puppet.settings.stringify_settings(:agent, :all).each_pair do |k,v|
406406
next if k.include?("password") || v.to_s.empty?
407+
407408
Puppet.debug("Using setting: #{k}=#{v}")
408409
end
409410
end

lib/puppet/application/apply.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@ def get_facts()
381381
def get_node()
382382
node = Puppet::Node.indirection.find(Puppet[:node_name_value])
383383
raise _("Could not find node %{node}") % { node: Puppet[:node_name_value] } unless node
384+
384385
node
385386
end
386387

@@ -394,6 +395,7 @@ def get_manifest()
394395
else
395396
manifest = command_line.args.shift
396397
raise _("Could not find file %{manifest}") % { manifest: manifest } unless Puppet::FileSystem.exist?(manifest)
398+
397399
Puppet.warning(_("Only one file can be applied per run. Skipping %{files}") % { files: command_line.args.join(', ') }) if command_line.args.size > 0
398400
end
399401
manifest

lib/puppet/application/describe.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ def initialize(width)
88

99
def wrap(txt, opts)
1010
return "" unless txt && !txt.empty?
11+
1112
work = (opts[:scrub] ? scrub(txt) : txt)
1213
indent = (opts[:indent] ? opts[:indent] : 0)
1314
textLen = @width - indent
@@ -56,6 +57,7 @@ def initialize
5657
Puppet::Type.loadall
5758
Puppet::Type.eachtype { |type|
5859
next if type.name == :component
60+
5961
@types[type.name] = type
6062
}
6163
end

lib/puppet/application/device.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ def main
233233
if options[:facts] and !options[:target]
234234
raise _("facts command requires target")
235235
end
236+
236237
unless options[:apply].nil?
237238
raise _("missing argument: --target is required when using --apply") if options[:target].nil?
238239
raise _("%{file} does not exist, cannot apply") % { file: options[:apply] } unless File.file?(options[:apply])

lib/puppet/application/face_base.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ def find_global_settings_argument(item)
158158
Puppet.settings.each do |_name, object|
159159
object.optparse_args.each do |arg|
160160
next unless arg =~ /^-/
161+
161162
# sadly, we have to emulate some of optparse here...
162163
pattern = /^#{arg.sub('[no-]', '').sub(/[ =].*$/, '')}(?:[ =].*)?$/
163164
pattern.match item and return object
@@ -170,8 +171,10 @@ def find_application_argument(item)
170171
self.class.option_parser_commands.each do |options, _function|
171172
options.each do |option|
172173
next unless option =~ /^-/
174+
173175
pattern = /^#{option.sub('[no-]', '').sub(/[ =].*$/, '')}(?:[ =].*)?$/
174176
next unless pattern.match(item)
177+
175178
return {
176179
:argument => option =~ /[ =]/,
177180
:optional => option =~ /[ =]\[/

lib/puppet/application/filebucket.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ def run_command
213213
@args = command_line.args
214214
command = args.shift
215215
return send(command) if %w{get backup restore diff list}.include? command
216+
216217
help
217218
end
218219

@@ -254,6 +255,7 @@ def restore
254255

255256
def diff
256257
raise Puppet::Error, _("Need exactly two arguments: filebucket diff <file_a> <file_b>") unless args.count == 2
258+
257259
left = args.shift
258260
right = args.shift
259261
if Puppet::FileSystem.exist?(left)

lib/puppet/application/lookup.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,7 @@ def retrieve_node_facts(node, given_facts)
426426
if facts.values.empty?
427427
raise _("No facts available for target node: %{node}") % { node: node}
428428
end
429+
429430
facts
430431
end
431432
end

0 commit comments

Comments
 (0)