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

Support autocorrection for percent literals in Style/ConcatArrayLiterals #11328

Merged
merged 1 commit into from Dec 25, 2022

Conversation

fatkodima
Copy link
Contributor

Fixes #11325.

%W/%I literals with interpolations inside are skipped for autocorrection, because they are rare and could further complicate this cop's logic. Other cases are pretty common.

RUBY

expect_correction(<<~RUBY)
item.push(:item)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor -- I find it confusing that this test file uses item for both the list and the item being inserted. list.push(:item) would make more sense

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, but this is how this is done for this entire spec file. Do not want to change the lines history and make diff bigger than is needed.
But if requested, will do with no problems..

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to add a second commit that changes this. I'd suggest using something like arr instead of item.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

@fatkodima fatkodima force-pushed the concat_array_literals-autocorrection branch from de187ed to a129b2f Compare December 25, 2022 10:28
@koic
Copy link
Member

koic commented Dec 25, 2022

This looks good to me. Can you squash your commits into one?

@fatkodima fatkodima force-pushed the concat_array_literals-autocorrection branch from a129b2f to 62d38f5 Compare December 25, 2022 13:47
@fatkodima
Copy link
Contributor Author

Squashed.

@koic koic merged commit 43cd246 into rubocop:master Dec 25, 2022
@koic
Copy link
Member

koic commented Dec 25, 2022

Thanks!

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.

Style/ConcatArrayLiterals autocorrection isn't working
4 participants