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

handle autocorrect exception in Style/BlockComments #6856

Merged
merged 1 commit into from Mar 23, 2019

Conversation

ericsullivan
Copy link
Contributor

@ericsullivan ericsullivan commented Mar 21, 2019

When a file ends with =end and does not have a final newline, the
autocorrect code of Style/BlockComments was producing an exception.
This change handles the exception and adds a final newline.

Replace this text with a summary of the changes in your PR.
The more detailed you are, the better.


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.

@ericsullivan ericsullivan force-pushed the handle_exception_in_block_comments branch 2 times, most recently from f26c39d to 0d0b279 Compare March 22, 2019 02:19
CHANGELOG.md Outdated
@@ -4,6 +4,7 @@

### Bug fixes
* [#6855](https://github.com/rubocop-hq/rubocop/pull/6855): Fix an exception in `Rails/RedundantReceiverInWithOptions` when the body is empty. ([@ericsullivan][])
* [#6856](https://github.com/rubocop-hq/rubocop/pull/6856): Fix AutoCorrect exception in `Style::BlockComments` when the file is missing a trailing blank line. ([@ericsullivan][])
Copy link
Member

Choose a reason for hiding this comment

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

It is a small point. It would be better to write Style::BlockComments as Style/BlockComments.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah, good point. The wording was a little different from previous auto-correction fixes, so I adjusted that as well.

When a file ends with `=end` and does not have a final newline, the
autocorrect code of Style/BlockComments was producing an exception.
This change handles the exception and adds a final newline.
@ericsullivan ericsullivan force-pushed the handle_exception_in_block_comments branch from 0d0b279 to 1537862 Compare March 22, 2019 13:21
@koic koic merged commit db1123e into rubocop:master Mar 23, 2019
@koic
Copy link
Member

koic commented Mar 23, 2019

Thanks!

@ericsullivan ericsullivan deleted the handle_exception_in_block_comments branch March 23, 2019 10:24
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

2 participants