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 encoding method of RuboCop::MagicComment::SimpleComment #5647

Merged
merged 1 commit into from
Mar 10, 2018

Conversation

htwroclau
Copy link
Contributor

@htwroclau htwroclau commented Mar 7, 2018

This PR fixes encoding method of RuboCop::MagicComment::SimpleComment for extracting by mistake of Lint/OrderedMagicComments.
example: CSV.generate(encoding: Encoding::UTF_8) do |csv|

I think that is solved by adding the condition of ‘# ’ before ‘encoding:’.


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 rake default or rake parallel. It executes all tests and RuboCop for itself, and generates the documentation.

@pocke
Copy link
Collaborator

pocke commented Mar 7, 2018

Can you add a test case(s) for this bug?

@htwroclau
Copy link
Contributor Author

I'll try it.

@htwroclau htwroclau force-pushed the fix_magic_comment_extract branch from e93ca8a to 5dbe00c Compare March 7, 2018 10:05
@bbatsov
Copy link
Collaborator

bbatsov commented Mar 9, 2018

It needs a changelog entry and we're good to go.

@htwroclau htwroclau force-pushed the fix_magic_comment_extract branch from 5dbe00c to 1bea697 Compare March 9, 2018 10:20
@htwroclau
Copy link
Contributor Author

@bbatsov
Thank you for your advice!

I added the changelog of this PR.

�$B!.�(BLint/OrderedMagicComments�$B!.�(B cop extracts codes including "encoding:" that is not comment.
e.g. `CSV.generate(encoding: Encoding::UTF_8) do |csv|`

I think that is solved by adding the condition of "# " before "encoding:".
@htwroclau htwroclau force-pushed the fix_magic_comment_extract branch from 1bea697 to e805abd Compare March 9, 2018 13:53
@bbatsov bbatsov merged commit dba6b75 into rubocop:master Mar 10, 2018
This was referenced Mar 21, 2018
This was referenced Mar 21, 2018
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.

3 participants