1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

rubocop: fix offences of the Style/RedundantParentheses cop

This commit is contained in:
Kyrylo Silin 2019-03-02 13:31:20 +02:00
parent 20f5356648
commit 1df89913ad
8 changed files with 7 additions and 20 deletions

View file

@ -314,19 +314,6 @@ Style/PerlBackrefs:
- 'lib/pry/method.rb'
- 'lib/pry/rubygem.rb'
# Offense count: 8
# Cop supports --auto-correct.
Style/RedundantParentheses:
Exclude:
- 'lib/pry/command.rb'
- 'lib/pry/commands/ls/jruby_hacks.rb'
- 'lib/pry/commands/ls/local_vars.rb'
- 'lib/pry/indent.rb'
- 'spec/command_integration_spec.rb'
- 'spec/commands/edit_spec.rb'
- 'spec/fixtures/example_nesting.rb'
- 'spec/method_spec.rb'
# Offense count: 6
# Cop supports --auto-correct.
# Configuration parameters: AllowMultipleReturnValues.

View file

@ -421,7 +421,7 @@ class Pry
gems_not_installed = gems_needed.reject { |g| Rubygem.installed?(g) }
output.puts(<<WARN)
The command #{Helpers::Text.bold(command_name)} is unavailable because it requires the following
gems to be installed: #{(gems_not_installed.join(", "))}
gems to be installed: #{gems_not_installed.join(", ")}
Type #{Helpers::Text.bold('install-command ' + command_name)} to install the required gems
and activate this command.

View file

@ -12,7 +12,7 @@ class Pry
name_value_pairs = @target.eval('local_variables').reject do |e|
@sticky_locals.key?(e.to_sym)
end.map do |name|
[name, (@target.eval(name.to_s))]
[name, @target.eval(name.to_s)]
end
format(name_value_pairs).join('')
end

View file

@ -215,7 +215,7 @@ class Pry
# If the list of tokens contains a matching closing token the line should
# not be indented (and thus we should return true).
tokens.each do |token, kind|
is_singleline_if = (SINGLELINE_TOKENS.include?(token)) && end_of_statement?(last_token, last_kind)
is_singleline_if = SINGLELINE_TOKENS.include?(token) && end_of_statement?(last_token, last_kind)
is_optional_do = (token == "do" && seen_for_at.include?(add_after - 1))
unless kind == :space

View file

@ -349,7 +349,7 @@ describe "commands" do
end
it 'should create a command in a nested context and that command should be accessible from the parent' do
expect(pry_tester(Object.new).eval(*(<<-RUBY.split("\n")))).to match(/instance variables:\s+@x/m)
expect(pry_tester(Object.new).eval(*<<-RUBY.split("\n"))).to match(/instance variables:\s+@x/m)
@x = nil
cd 7
_pry_.commands.instance_eval { command('bing') { |arg| run arg } }

View file

@ -459,7 +459,7 @@ describe "edit" do
before do
Object.remove_const :X if defined? ::X
Object.remove_const :A if defined? ::A
@tempfile = (Tempfile.new(['pry', '.rb']))
@tempfile = Tempfile.new(['pry', '.rb'])
@tempfile.puts <<-EOS
module A
def a

View file

@ -14,7 +14,7 @@ class << A # ["class << A"]
end # ["class << A"]
end # []
# []
module (:symbol.class)::Exciting #
module :symbol.class::Exciting #
def foo; end #
class B #
def goo; end #

View file

@ -482,7 +482,7 @@ describe Pry::Method do
end
it "should include modules at the point which they would be reached" do
expect(Pry::Method.resolution_order(LS::Bottom)).to eq [eigen_class(LS::Bottom), LS::O] + (Pry::Method.resolution_order(LS::Lower))
expect(Pry::Method.resolution_order(LS::Bottom)).to eq [eigen_class(LS::Bottom), LS::O] + Pry::Method.resolution_order(LS::Lower)
end
it "should include the Pry::Method.instance_resolution_order of Class after the singleton classes" do