-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Rename LiteralInCondition and RegexpInCondition to LiteralAsCondition and RegexpAsCondition #4864
Conversation
… and RegexpAsCondition - Lint/LiteralInCondition => Lint/LiteralAsCondition - Lint/RegexpInCondition => Lint/RegexpAsCondition - Improve the offense message - Improve the cop description
60a3b53
to
6752d3a
Compare
CHANGELOG.md
Outdated
@@ -10,7 +10,7 @@ | |||
* [#4796](https://github.com/bbatsov/rubocop/pull/4796): Add new `Lint/RedundantWithObject` cop. ([@koic][]) | |||
* [#4663](https://github.com/bbatsov/rubocop/issues/4663): Add new `Style/CommentedKeyword` cop. ([@donjar][]) | |||
* Add `IndentationWidth` configuration for `Layout/Tab` cop. ([@rrosenblum][]) | |||
* [#4854](https://github.com/bbatsov/rubocop/pull/4854): Add new `Lint/RegexpInCondition` cop. ([@pocke][]) | |||
* [#4854](https://github.com/bbatsov/rubocop/pull/4854): Add new `Lint/RegexpInCondition` cop(Note: This cop was renamed to `Lint/RegexpAsCondition`). ([@pocke][]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this is unreleased I guess you can just update the name in place.
class RegexpInCondition < Cop | ||
MSG = 'Do not use regexp literal in condition.' \ | ||
class RegexpAsCondition < Cop | ||
MSG = 'Do not use regexp literal as condition.' \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as a
config/enabled.yml
Outdated
Description: >- | ||
Do not use regexp literal in condition. | ||
Do not use regexp literal as condition. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as a
Btw, on an unrelated note - probably the messages should also feature the literal in question, so they are more useful to end users. |
By renaming the config key LiteralInCondition -> LiteralAsCondition. The former cop was renamed in Rubocop v0.50.0 [1] and was causing the following deprecation warning to be displayed: Warning: unrecognized cop LiteralInCondition found in ... [1]: https://github.com/bbatsov/rubocop/blob/v0.51.0/CHANGELOG.md#changes [2]: rubocop/rubocop#4864
This changed with rubocop/rubocop#4864. Closes #505.
Renamed in rubocop/rubocop#4864 Signed-off-by: Tim Smith <[email protected]>
Follow up for #4854 (comment)
This change renames cops, and improves the message and description.
Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).rake spec
) are passing.rake internal_investigation
.and description in grammatically correct, complete sentences.
rake generate_cops_documentation
(required only when you've added a new cop or changed the configuration/documentation of an existing cop).