-
-
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
Is EndAlignment not a Layout cop? #4704
Comments
|
I think the Layout namespace makes a lot of sense. My .rubocop.yml files almost entirely consist of changing the enforced styles of Layout cops. I didn’t really know what was the difference between Lint and Style, and I have never used the severity level feature of RuboCop. I just now read this part of the manual:
I actually think Probably |
These cops are in the |
I don’t immediately see how any of the offenses caught by these 4 cops might be a bug. Can you give any examples? |
I was looking through the style guide (and the internet) but can't find any examples of bugs caused by misaligned I agree it would be convenient to have these together in |
Edit: this code makes an offense from Perhaps it is a warning in Rubocop because it is a warning in Ruby:
|
MRI treats this as a warning and that's the reason why it's a lint cop in RuboCop as well. I think the reasoning was that you might not perceive properly which scope are you operating in because of the broken alignment. |
Exactly. |
I'm so sorry for the confusion, but the code I posted is not an offense for variable = if true
end I got mixed up by the names of these cops. |
I see Ruby warnings for
# Lint/EndAlignment
class Test
end
# Lint/DefEndAlignment
def test
end
# Lint/BlockAlignment
test do
end
# Lint/ConditionPosition
if
true
"true"
elsif
false
"false"
end
|
Also relevant comment: #1789 (comment)
|
Oftentimes, a misaligned `end` on module/class definition is just a whitespace/indentation error. Having it fixed together with the other `Layout` cops by e.g. `rubocop --auto-correct --only Layout` is very convenient. But since it *may* be something more serious than just a style issue, cop violations are still of severity `warning`.
Oftentimes, a misaligned `end` on module/class definition is just a whitespace/indentation error. Having it fixed together with the other `Layout` cops by e.g. `rubocop --auto-correct --only Layout` is very convenient. But since it *may* be something more serious than just a style issue, cop violations are still of severity `warning`.
* Style/TrailingCommaInLiteral is splited into two new cops since v0.53.0 * see. rubocop/rubocop#5404 * Lint/EndAlignment is moved to Layout namespace * see. rubocop/rubocop#4704
* Style/TrailingCommaInLiteral is splited into two new cops since v0.53.0 * see. rubocop/rubocop#5404 * Lint/EndAlignment is moved to Layout namespace * see. rubocop/rubocop#4704
In #4278, a bunch of whitespace cops were moved into the new “Layout department”. Since, I have wondered why
Lint/EndAlignment
wasn’t moved along with them.The text was updated successfully, but these errors were encountered: