-
-
Notifications
You must be signed in to change notification settings - Fork 277
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
Add NegatedMatcher
configuration option to RSpec/ChangeByZero
#1349
Conversation
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.
Looks great, thank you!
I've just learned to use the suggestion feature the other day, please don't judge me too hard for its abuse, and please don't hesitate to reject and discuss suggestions just as before as you see fit.
118054e
to
9a19cac
Compare
9a19cac
to
4e7abe7
Compare
Now passed the CI for default.yml . |
compound expectations, but if you set the | ||
negated matcher for `change`, e.g. `not_change` with | ||
the `NegatedMatcher` option, the cop will perform the autocorrection. | ||
`NegatedMatcher` option, will be autocorrect. |
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.
this seems redundant?
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.
I was adding that I thought it might be confusing for cases that does not support autocorrected. I think a polite explanation would be about right. What do you think?
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.
I mean that the last sentence, ``NegatedMatcher option, will be autocorrect.
is just repeating the previous one, and it's also incomplete anyway
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.
Ah! I was mistaken. Thank you very much. It is indeed so I have corrected it. How about it?
8bddf70
to
b01f898
Compare
This PR is add `NegatedMatcher` option to `RSpec/ChangeByZero`. In the case of composite expectations, cop suggest using the negation matchers of `RSpec::Matchers#change`. By default doe's not support autocorrect, but if you set the negation matcher of `RSpec::Matchers#change` defined in `NegatedMatcher` option, will be autocorrect.
b01f898
to
2d32d0d
Compare
This PR is add
NegatedMatcher
option toRSpec/ChangeByZero
.In the case of composite expectations, cop suggest using the negation matchers of
RSpec::Matchers#change
.By default doe's not support autocorrect, but if you set the negation matcher of
RSpec::Matchers#change
defined inNegatedMatcher
option, will be autocorrect.Before submitting the PR make sure the following are checked:
master
(if not - rebase it).CHANGELOG.md
if the new code introduces user-observable changes.bundle exec rake
) passes (be sure to run this locally, since it may produce updated documentation that you will need to commit).If you have created a new cop:
config/default.yml
.Enabled: pending
inconfig/default.yml
.Enabled: true
in.rubocop.yml
.VersionAdded
indefault/config.yml
to the next minor version.If you have modified an existing cop's configuration options:
VersionChanged
inconfig/default.yml
to the next major version.