Skip to content

Commit 0e66370

Browse files
committed
Lint/UnusedBlockArgument
Prepend underscore to unused block arguments
1 parent e07f815 commit 0e66370

File tree

103 files changed

+150
-154
lines changed

Some content is hidden

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

103 files changed

+150
-154
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -638,10 +638,6 @@ Lint/ToJSON:
638638
- 'lib/puppet/network/http/error.rb'
639639
- 'lib/puppet/pops/serialization/json.rb'
640640

641-
# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
642-
Lint/UnusedBlockArgument:
643-
Enabled: false
644-
645641
# This cop supports safe auto-correction (--auto-correct).
646642
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods.
647643
Lint/UnusedMethodArgument:

lib/puppet/application.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,13 +327,13 @@ def clear_everything_for_tests
327327
# Every app responds to --version
328328
# See also `lib/puppet/util/command_line.rb` for some special case early
329329
# handling of this.
330-
option("--version", "-V") do |arg|
330+
option("--version", "-V") do |_arg|
331331
puts "#{Puppet.version}"
332332
exit(0)
333333
end
334334

335335
# Every app responds to --help
336-
option("--help", "-h") do |v|
336+
option("--help", "-h") do |_v|
337337
puts help
338338
exit(0)
339339
end

lib/puppet/application/agent.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def preinit
6464

6565
option("--sourceaddress IP_ADDRESS")
6666

67-
option("--detailed-exitcodes") do |arg|
67+
option("--detailed-exitcodes") do |_arg|
6868
options[:detailed_exitcodes] = true
6969
end
7070

lib/puppet/application/apply.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Puppet::Application::Apply < Puppet::Application
2929
handle_logdest_arg(arg)
3030
end
3131

32-
option("--parseonly") do |args|
32+
option("--parseonly") do |_args|
3333
puts "--parseonly has been removed. Please use 'puppet parser validate <manifest>'"
3434
exit 1
3535
end

lib/puppet/application/describe.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def list_providers(type)
166166
class Puppet::Application::Describe < Puppet::Application
167167
banner "puppet describe [options] [type]"
168168

169-
option("--short", "-s", "Only list parameters without detail") do |arg|
169+
option("--short", "-s", "Only list parameters without detail") do |_arg|
170170
options[:parameters] = false
171171
end
172172

lib/puppet/application/device.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def preinit
5252
option("--to_yaml","-y")
5353
option("--verbose","-v")
5454

55-
option("--detailed-exitcodes") do |arg|
55+
option("--detailed-exitcodes") do |_arg|
5656
options[:detailed_exitcodes] = true
5757
end
5858

@@ -251,7 +251,7 @@ def main
251251
require_relative '../../puppet/util/network_device/config'
252252
devices = Puppet::Util::NetworkDevice::Config.devices.dup
253253
if options[:target]
254-
devices.select! { |key, value| key == options[:target] }
254+
devices.select! { |key, _value| key == options[:target] }
255255
end
256256
if devices.empty?
257257
if options[:target]
@@ -261,7 +261,7 @@ def main
261261
exit(1)
262262
end
263263
end
264-
devices.collect do |devicename,device|
264+
devices.collect do |_devicename,device|
265265
# TODO when we drop support for ruby < 2.5 we can remove the extra block here
266266
begin
267267
device_url = URI.parse(device.url)

lib/puppet/application/doc.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def preinit
3939
end
4040
end
4141

42-
option("--list", "-l") do |arg|
42+
option("--list", "-l") do |_arg|
4343
require_relative '../../puppet/util/reference'
4444
refs = Puppet::Util::Reference.references(Puppet.lookup(:current_environment))
4545
puts refs.collect { |r| Puppet::Util::Reference.reference(r).doc }.join("\n")

lib/puppet/application/face_base.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
require 'pp'
66

77
class Puppet::Application::FaceBase < Puppet::Application
8-
option("--debug", "-d") do |arg|
8+
option("--debug", "-d") do |_arg|
99
set_log_level(:debug => true)
1010
end
1111

@@ -17,7 +17,7 @@ class Puppet::Application::FaceBase < Puppet::Application
1717
self.render_as = format.to_sym
1818
end
1919

20-
option("--help", "-h") do |arg|
20+
option("--help", "-h") do |_arg|
2121
if action && !@is_default_action
2222
# Only invoke help on the action if it was specified, not if
2323
# it was the default action.
@@ -155,7 +155,7 @@ def parse_options
155155
end
156156

157157
def find_global_settings_argument(item)
158-
Puppet.settings.each do |name, object|
158+
Puppet.settings.each do |_name, object|
159159
object.optparse_args.each do |arg|
160160
next unless arg =~ /^-/
161161
# sadly, we have to emulate some of optparse here...
@@ -167,7 +167,7 @@ def find_global_settings_argument(item)
167167
end
168168

169169
def find_application_argument(item)
170-
self.class.option_parser_commands.each do |options, function|
170+
self.class.option_parser_commands.each do |options, _function|
171171
options.each do |option|
172172
next unless option =~ /^-/
173173
pattern = /^#{option.sub('[no-]', '').sub(/[ =].*$/, '')}(?:[ =].*)?$/

lib/puppet/application/resource.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def preinit
1515
option("--edit","-e")
1616
option("--to_yaml","-y")
1717

18-
option("--types", "-t") do |arg|
18+
option("--types", "-t") do |_arg|
1919
env = Puppet.lookup(:environments).get(Puppet[:environment]) || create_default_environment
2020
types = []
2121
Puppet::Type.typeloader.loadall(env)

lib/puppet/defaults.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2036,7 +2036,7 @@ def self.initialize_default_settings!(settings)
20362036
:type => :boolean,
20372037
:desc => "Whether plugins should be synced with the central server. This setting is
20382038
deprecated.",
2039-
:hook => proc { |value|
2039+
:hook => proc { |_value|
20402040
#TRANSLATORS 'pluginsync' is a setting and should not be translated
20412041
Puppet.deprecation_warning(_("Setting 'pluginsync' is deprecated."))
20422042
}

0 commit comments

Comments
 (0)