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 #7509] Layout/SpaceInsideArrayLiteralBrackets to correct empty lines #7511

Merged

Conversation

ayacai115
Copy link

@ayacai115 ayacai115 commented Nov 17, 2019

Fixed Layout/SpaceInsideArrayLiteralBrackets to correct empty lines.
See #7509 for details.


Before submitting the PR make sure the following are checked:

  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Added an entry to the Changelog if the new code introduces user-observable changes. See changelog entry format.
  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • Run bundle exec rake default. It executes all tests and RuboCop for itself, and generates the documentation.

@ayacai115 ayacai115 force-pushed the add-autofix-to-SpaceInsideArrayLiteralBrackets branch from 8bed5b8 to 7b0fbc6 Compare November 17, 2019 23:43
@ayacai115 ayacai115 changed the title [WIP] [Fix #7509] Layout/SpaceInsideArrayLiteralBrackets to correct empty lines [Fix #7509] Layout/SpaceInsideArrayLiteralBrackets to correct empty lines Nov 18, 2019
@@ -12,12 +12,11 @@ class << self
def empty_corrections(processed_source, corrector, empty_config,
left_token, right_token)
@processed_source = processed_source
range = range_between(left_token.end_pos, right_token.begin_pos)
Copy link
Author

Choose a reason for hiding this comment

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

@Drenmi
Copy link
Collaborator

Drenmi commented Nov 18, 2019

Normally, the edge case that comes up for these kinds of cops is with comments, e.g.:

foo = [
# Intentionally left empty
]

@ayacai115
Copy link
Author

@Drenmi
That's true.

What I'd like to fix is that rubocop raises a warning and says "corrected" but it's not actually corrected, which is a bug.

Regarding your suggestion, it's about how the syntax rule should be, so maybe we can discuss in another issue?

@Drenmi
Copy link
Collaborator

Drenmi commented Nov 18, 2019

What I'd like to fix is that rubocop raises a warning and says "corrected" but it's not actually corrected, which is a bug.

I see. 🙂 Yes. My comment is a bit tangential then, although fixing the bug is likely going to cause comments to be destroyed on auto-correct, so I think we should at least open a new issue for it, if it's not in scope of this PR. 👍

@ayacai115
Copy link
Author

@Drenmi Thanks for your suggestion😄
I opened a issue for that: #7512

@buehmann
Copy link
Contributor

Normally, the edge case that comes up for these kinds of cops is with comments, e.g.:

That's not an issue here because the "empty brackets" detection works on the token level.

@koic koic merged commit f6ab020 into rubocop:master Nov 20, 2019
@koic
Copy link
Member

koic commented Nov 20, 2019

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.

None yet

4 participants