Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No cop checking for indentation of parameters? #2173

Closed
bquorning opened this issue Aug 22, 2015 · 2 comments
Closed

No cop checking for indentation of parameters? #2173

bquorning opened this issue Aug 22, 2015 · 2 comments

Comments

@bquorning
Copy link
Contributor

Checked on the latest master of RuboCop (0f260a6), this file produces no warnings:

# encoding: utf-8
def x(
    a: 1,
b: 2)
  puts a, b
end

def y(
    a,
b)
  puts a, b
end

The indentation is clearly wrong, but what would be the correct indentation?

def y(
      a,
      b
     )
  puts a, b
end

# or

def y(
  a,
  b
)
  puts a, b
end

# or

def y(a,
      b)
  puts a, b
end
@bquorning
Copy link
Contributor Author

Ping @jonas054 :-)

@jonas054
Copy link
Collaborator

Thanks for the reminder. 😄 Well, first of all, they should of course be aligned. We should add that check to the duties of Style/AlignParameters.

About the parentheses, we're already checking in Style/ClosingParenthesisIndentation that ") [is indented] the same as the start of the line where ( is" or that the parentheses are aligned if there's no line break inside the opening parenthesis. We could perhaps add some checking for symmetry. If one parenthesis (or curly brace or square bracket) has a line break on the inside, then the other one should have it too.

alexdowad added a commit to alexdowad/rubocop that referenced this issue Nov 2, 2015
…method definitions

The same 2 styles which AlignParameters already supports are applied in just the same
way to method definitions as to calls.
bbatsov added a commit that referenced this issue Nov 2, 2015
[Fix #2173] `Style/AlignParameters` also checks parameters on method defintions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants