Skip to content

Commit 8b93450

Browse files
committed
Autocorrect rubocop violations
1 parent ad0f2c7 commit 8b93450

File tree

5 files changed

+8
-9
lines changed

5 files changed

+8
-9
lines changed

.rubocop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ Lint/EndAlignment:
9090
- 'lib/thor/actions.rb'
9191
- 'lib/thor/parser/option.rb'
9292

93-
Lint/Eval:
93+
Security/Eval:
9494
Exclude:
9595
- 'spec/helper.rb'
9696

lib/thor.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ def subcommand(subcommand, subcommand_class)
241241
invoke_args.unshift "help" if opts.delete("--help") || opts.delete("-h")
242242
invoke subcommand_class, *invoke_args
243243
end
244-
subcommand_class.commands.each do |meth, command|
244+
subcommand_class.commands.each do |_meth, command|
245245
command.ancestor_name = subcommand
246246
end
247247
end

lib/thor/actions/file_manipulation.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ def inject_into_class(path, klass, *args, &block)
225225
#
226226
def inject_into_module(path, module_name, *args, &block)
227227
config = args.last.is_a?(Hash) ? args.pop : {}
228-
config.merge!(:after => /module #{module_name}\n|module #{module_name} .*\n/)
228+
config[:after] = /module #{module_name}\n|module #{module_name} .*\n/
229229
insert_into_file(path, *(args << config), &block)
230230
end
231231

@@ -331,7 +331,8 @@ def capture(*args)
331331
end
332332

333333
def with_output_buffer(buf = "") #:nodoc:
334-
self.output_buffer, old_buffer = buf, output_buffer
334+
old_buffer = output_buffer
335+
self.output_buffer = buf
335336
yield
336337
output_buffer
337338
ensure

spec/subcommand_spec.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,8 @@ class Parent < Thor
5959
end
6060

6161
it "shows subcommand name and method name" do
62-
sub_help = capture(:stderr) { SubcommandTest1::Parent.start(%w[child1 foo]) }
63-
expect(sub_help).to eq ['ERROR: "thor child1 foo" was called with no arguments', 'Usage: "thor child1 foo NAME"', ''].join("\n")
62+
sub_help = capture(:stderr) { SubcommandTest1::Parent.start(%w(child1 foo)) }
63+
expect(sub_help).to eq ['ERROR: "thor child1 foo" was called with no arguments', 'Usage: "thor child1 foo NAME"', ""].join("\n")
6464
end
6565
end
66-
6766
end

spec/thor_spec.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,7 @@ def shell
428428
class_option :foo, :required => true
429429

430430
desc "bar", "do something"
431-
def bar
432-
end
431+
def bar; end
433432
end
434433
end
435434

0 commit comments

Comments
 (0)