-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Add MaxLength parameter to IfUnlessModifier and WhileUntilModifier #795
Conversation
👍 Actually I've been thinking same thing. :) |
I think the parameter name IfUnlessModifier:
MaxLength: 80 # Length of what? |
Yep, |
I also wonder if it makes sense to add some config regarding the complexity of the condition - this could make the cop accept conditions with # this would normally be an offence, but it has an `&&` in it
if something && something_else
do_something
end This is based on an observation of mine that some people like to use the modifier forms only for conditions that consist of a single expression. |
This is the first parameter we introduce that doesn't have a default value. This means that
I'm thinking about where to describe it. The parameter is a bit hidden. One solution would be to set a default value of |
I think that a default value of |
I'm happy with a more verbose parameter name, such as I agree that I won't be able to implement |
@agrimm OK. Let me you know when you've updated the PR. |
👍 for |
@agrimm Ping :-) |
Been a bit busy, but my Ukrainian revolution is finished now. :) An updated PR should be ready by the end of this weekend. |
Ha, I was just going to open an issue for this. I usually do single line, but wrap it into a block if it's over 80 characters. |
…r, so that their own maximum line length can be set
@bbatsov Pong :-) |
Add MaxLength parameter to IfUnlessModifier and WhileUntilModifier
Thanks! |
Currently, if you have a high value for
Max
inLineLength
, then theIfUnlessModifier
andWhileUntilModifier
cops will suggest a modifier style, even if it results in a very long line.This change means you can specify a maximum length for these specific cops.