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

[Fix #7885] Re-use LineLengthHelp for statement modifiers #7926

Merged

Conversation

jonas054
Copy link
Collaborator

@jonas054 jonas054 commented May 3, 2020

This is a new attempt at a PR that was first made in #7924. The changes are pretty much the same but the description should be more correct this time.

There's no reason to have two implementations of the same logic. They weren't exactly the same, but I think the one in LineLengthHelp was correct, apart from falling back to Layout/IndentationWidth:Width if Layout/IndentationStyle:IndentationWidth is nil, which is now added to match the description of the Layout/IndentationStyle parameters in default.yml.

Added some examples on line length with tabs indentation in line_length_spec.rb.

Updated if_unless_modifier_spec to cover the fallback on Layout/IndentationWidth:Width better, and removed an example that could not happen in real execution ("without any IndentationWidth config"). The spec examples now work like before, but without requiring Layout/IndentationStyle to be disabled.

There's no reason to have two implementations of the same logic. They
weren't exactly the same, but I think the one in LineLengthHelp was
correct, apart from falling back to Layout/IndentationWidth:Width if
Layout/IndentationStyle:IndentationWidth is nil, which is now added
to match the description of the Layout/IndentationStyle parameters
in default.yml.

Added some examples on line length with tabs indentation in
line_length_spec.rb.

Updated if_unless_modifier_spec to cover the fallback on
Layout/IndentationWidth:Width better, and removed an example that
could not happen in real execution ("without any IndentationWidth
config"). The spec examples now work like before, but without
requiring Layout/IndentationStyle to be disabled.
@jonas054 jonas054 requested a review from koic May 3, 2020 15:46
@jonas054 jonas054 merged commit 21a1b2b into rubocop:master May 7, 2020
@jonas054 jonas054 deleted the 7885_IfUnlessModifier_with_tab_indentation branch May 7, 2020 08:52
@AlexWayfer
Copy link
Contributor

@jonas054, thank you, but I've found similar bug: #8041

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

Successfully merging this pull request may close these issues.

None yet

3 participants