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 an auto-correction bug in Lint/BooleanSymbol #7871

Merged
merged 1 commit into from Apr 13, 2020

Conversation

@knu
Copy link
Contributor

knu commented Apr 13, 2020

It replaces a boolean symbol in a hash value as if it were a key, generating a broken piece of code.

# before
{ null: :false }

# after: wrong (current behavior)
{ null :false => }

# after: correct (fixed behavior)
{ null: false }
# before
{ false: :false }

# after: wrong (current behavior)
{ false => :false => }

# after: correct (fixed behavior)
{ false => false }

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.
knu added a commit to knu/rubocop that referenced this pull request Apr 13, 2020
@koic
Copy link
Member

koic commented Apr 13, 2020

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

@knu
Copy link
Contributor Author

knu commented Apr 13, 2020

@koic I just felt like it would create a time paradox to include a change log update with a PR number in a single commit, but I will if you say so. 😆

@knu knu force-pushed the knu:fix_boolean_symbol_autocorrection branch from 859f7e9 to 2b24253 Apr 13, 2020
@@ -12,6 +12,7 @@

### Bug fixes

* [#7871](https://github.com/rubocop-hq/rubocop/pull/7871): Fix an auto-correction bug in Lint/BooleanSymbol. ([@knu][])

This comment has been minimized.

Copy link
@koic

koic Apr 13, 2020

Member

Oops, I overlooked one. Can you enclose the cop name in backticks?

Suggested change
* [#7871](https://github.com/rubocop-hq/rubocop/pull/7871): Fix an auto-correction bug in Lint/BooleanSymbol. ([@knu][])
* [#7871](https://github.com/rubocop-hq/rubocop/pull/7871): Fix an auto-correction bug in `Lint/BooleanSymbol`. ([@knu][])

This comment has been minimized.

Copy link
@knu

knu Apr 13, 2020

Author Contributor

Done!

It replaces a boolean symbol in a hash value as if it were a key,
generating a broken piece of code.

```ruby
# before
{ null: :false }

# wrong (current behavior)
{ null :false => }

# wrong (fixed behavior)
{ null: false }
```

```ruby
# before
{ false: :false }

# wrong (current behavior)
{ false => :false => }

# wrong (fixed behavior)
{ false => false }
```
@knu knu force-pushed the knu:fix_boolean_symbol_autocorrection branch from 2b24253 to 851784b Apr 13, 2020
@koic koic merged commit ba598be into rubocop-hq:master Apr 13, 2020
22 checks passed
22 checks passed
ci/circleci: cc-setup Your tests passed on CircleCI!
Details
ci/circleci: cc-upload-coverage Your tests passed on CircleCI!
Details
ci/circleci: documentation-checks Your tests passed on CircleCI!
Details
ci/circleci: jruby-9.2-ascii_spec Your tests passed on CircleCI!
Details
ci/circleci: jruby-9.2-rubocop Your tests passed on CircleCI!
Details
ci/circleci: jruby-9.2-spec Your tests passed on CircleCI!
Details
ci/circleci: ruby-2.4-ascii_spec Your tests passed on CircleCI!
Details
ci/circleci: ruby-2.4-rubocop Your tests passed on CircleCI!
Details
ci/circleci: ruby-2.4-spec Your tests passed on CircleCI!
Details
ci/circleci: ruby-2.5-ascii_spec Your tests passed on CircleCI!
Details
ci/circleci: ruby-2.5-rubocop Your tests passed on CircleCI!
Details
ci/circleci: ruby-2.5-spec Your tests passed on CircleCI!
Details
ci/circleci: ruby-2.6-ascii_spec Your tests passed on CircleCI!
Details
ci/circleci: ruby-2.6-rubocop Your tests passed on CircleCI!
Details
ci/circleci: ruby-2.6-spec Your tests passed on CircleCI!
Details
ci/circleci: ruby-2.7-ascii_spec Your tests passed on CircleCI!
Details
ci/circleci: ruby-2.7-rubocop Your tests passed on CircleCI!
Details
ci/circleci: ruby-2.7-spec Your tests passed on CircleCI!
Details
ci/circleci: ruby-head-ascii_spec Your tests passed on CircleCI!
Details
ci/circleci: ruby-head-rubocop Your tests passed on CircleCI!
Details
ci/circleci: ruby-head-spec Your tests passed on CircleCI!
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
@koic
Copy link
Member

koic commented Apr 13, 2020

Thank you!

@knu knu deleted the knu:fix_boolean_symbol_autocorrection branch Apr 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.