mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
rubocop: fix offences of the Layout/FirstParameterIndentation cop
This commit is contained in:
parent
f0a6af8492
commit
970d0e1d57
5 changed files with 53 additions and 46 deletions
|
@ -13,17 +13,6 @@ Gemspec/RequiredRubyVersion:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'pry.gemspec'
|
- 'pry.gemspec'
|
||||||
|
|
||||||
# Offense count: 9
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
|
||||||
# SupportedStyles: consistent, consistent_relative_to_receiver, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
|
|
||||||
Layout/FirstParameterIndentation:
|
|
||||||
Exclude:
|
|
||||||
- 'lib/pry/input_completer.rb'
|
|
||||||
- 'spec/command_spec.rb'
|
|
||||||
- 'spec/commands/ls_spec.rb'
|
|
||||||
- 'spec/method_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 3
|
# Offense count: 3
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
||||||
|
|
|
@ -20,13 +20,19 @@ describe "ls" do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should include super-classes by default" do
|
it "should include super-classes by default" do
|
||||||
expect(pry_eval(
|
expect(
|
||||||
|
pry_eval(
|
||||||
"cd Class.new(Class.new{ def goo; end; public :goo }).new",
|
"cd Class.new(Class.new{ def goo; end; public :goo }).new",
|
||||||
"ls")).to match(/goo/)
|
"ls"
|
||||||
|
)
|
||||||
|
).to match(/goo/)
|
||||||
|
|
||||||
expect(pry_eval(
|
expect(
|
||||||
|
pry_eval(
|
||||||
"cd Class.new(Class.new{ def goo; end; public :goo })",
|
"cd Class.new(Class.new{ def goo; end; public :goo })",
|
||||||
"ls -M")).to match(/goo/)
|
"ls -M"
|
||||||
|
)
|
||||||
|
).to match(/goo/)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should not include super-classes when -q is given" do
|
it "should not include super-classes when -q is given" do
|
||||||
|
@ -47,10 +53,12 @@ describe "ls" do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should work on subclasses of BasicObject" do
|
it "should work on subclasses of BasicObject" do
|
||||||
expect(pry_eval(
|
expect(
|
||||||
|
pry_eval(
|
||||||
"class LessBasic < BasicObject; def jaroussky; 5; end; end",
|
"class LessBasic < BasicObject; def jaroussky; 5; end; end",
|
||||||
"ls LessBasic.new"
|
"ls LessBasic.new"
|
||||||
)).to match(/LessBasic#methods:.*jaroussky/m)
|
)
|
||||||
|
).to match(/LessBasic#methods:.*jaroussky/m)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -127,6 +135,7 @@ describe "ls" do
|
||||||
expect(result).not_to match(/0x\d{5}/)
|
expect(result).not_to match(/0x\d{5}/)
|
||||||
expect(result).to match(/asdf.*xyz/m)
|
expect(result).to match(/asdf.*xyz/m)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should not list pry noise' do
|
it 'should not list pry noise' do
|
||||||
expect(pry_eval('ls -l')).not_to match(/_(?:dir|file|ex|pry|out|in)_/)
|
expect(pry_eval('ls -l')).not_to match(/_(?:dir|file|ex|pry|out|in)_/)
|
||||||
end
|
end
|
||||||
|
@ -134,17 +143,23 @@ describe "ls" do
|
||||||
|
|
||||||
describe "when inside Modules" do
|
describe "when inside Modules" do
|
||||||
it "should still work" do
|
it "should still work" do
|
||||||
expect(pry_eval(
|
expect(
|
||||||
|
pry_eval(
|
||||||
"cd Module.new{ def foobie; end; public :foobie }",
|
"cd Module.new{ def foobie; end; public :foobie }",
|
||||||
"ls -M")).to match(/foobie/)
|
"ls -M"
|
||||||
|
)
|
||||||
|
).to match(/foobie/)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should work for ivars" do
|
it "should work for ivars" do
|
||||||
expect(pry_eval(
|
expect(
|
||||||
|
pry_eval(
|
||||||
"module StigmaT1sm; def foobie; @@gharble = 456; end; end",
|
"module StigmaT1sm; def foobie; @@gharble = 456; end; end",
|
||||||
"Object.new.tap{ |o| o.extend(StigmaT1sm) }.foobie",
|
"Object.new.tap{ |o| o.extend(StigmaT1sm) }.foobie",
|
||||||
"cd StigmaT1sm",
|
"cd StigmaT1sm",
|
||||||
"ls -i")).to match(/@@gharble/)
|
"ls -i"
|
||||||
|
)
|
||||||
|
).to match(/@@gharble/)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should include instance methods by default" do
|
it "should include instance methods by default" do
|
||||||
|
@ -184,11 +199,13 @@ describe "ls" do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should show constants for an object's class regardless of mixins" do
|
it "should show constants for an object's class regardless of mixins" do
|
||||||
expect(pry_eval(
|
expect(
|
||||||
|
pry_eval(
|
||||||
"cd Pry.new",
|
"cd Pry.new",
|
||||||
"extend Module.new",
|
"extend Module.new",
|
||||||
"ls -c"
|
"ls -c"
|
||||||
)).to match(/Method/)
|
)
|
||||||
|
).to match(/Method/)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -486,10 +486,11 @@ describe Pry::Method do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should include the Pry::Method.instance_resolution_order of Class after the singleton classes" do
|
it "should include the Pry::Method.instance_resolution_order of Class after the singleton classes" do
|
||||||
expect(Pry::Method.resolution_order(LS::Top)).to eq(
|
singleton_classes = [
|
||||||
[eigen_class(LS::Top), eigen_class(Object), eigen_class(BasicObject),
|
eigen_class(LS::Top), eigen_class(Object), eigen_class(BasicObject),
|
||||||
*Pry::Method.instance_resolution_order(Class)]
|
*Pry::Method.instance_resolution_order(Class)
|
||||||
)
|
]
|
||||||
|
expect(Pry::Method.resolution_order(LS::Top)).to eq(singleton_classes)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue