-
Notifications
You must be signed in to change notification settings - Fork 0
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
Bug: Discrepancy between lint failures in autocorrect
and force_update
?
#24
Comments
Autocorrect should run the complete rubocop linting. It should still fail, even if it can't fix anything. Regular rubocop fails the same way with or without the |
@skryukov any thoughts on this? |
Hey, @pboling! Sorry for the delay.
Yes, that's exactly our approach—we initially run autocorrect, followed by the default rubocop-gradual command: rubocop-gradual/lib/rubocop/gradual/commands/autocorrect.rb Lines 10 to 21 in dd23f28
Based on the logs you shared, the number of inspected files is consistent, yet the number of detected issues varies, the question is why 🤔 I tried to reproduce the issue, but failed. To get more info we could try adding a debug option to the
|
One thing I have noticed is that most of the issues I've had with discrepancies have come from |
IMO - it is important that autocorrect run the same rules as a regular check, because that seems to be the behavior of RuboCop, and developers have been trained over many years to just run Since gradual allows hijacking of rubocop to run rubocop_gradual in it's place, it makes sense to support the existing expectations and workflow of developers. We have the hijack in place, so people run |
I was confused about your comment:
You're saying that this is what you expect to happen for everyone, as that is what the code in rubocop_gradual is intended to do? That is definitely nothing like our experience, if so. |
More info, just saw this again, and this time (thankfully) it is in a fully open source repo. Without changing any files in between these commands:
|
- caveat, linting will fail on autocorrect - See: skryukov/rubocop-gradual#24 (comment)
@skryukov Starting with a clean git working tree. I ran My ENVforce_update
check
autocorrect
This is where the discrepancy occurs. The autocorrect output says there were no changes... but that's not true.
The lockfile was changed. It should have failed, but it reported success with not changes found despite making actual changes. This is born out by running 2nd check
2nd autocorrectStrangely, and as evidence of the discrepancy, if I run autocorrect again (still with the changed lockfile that just failed the 2nd check above), it will pass saying there are no changes. This means that
Because of this discrepancy I can no longer use |
Thanks @pboling I'll try to look into it next week |
I should add that so far all of the discrepancy in rules that I've paid enough attention to remember has been from one single rule: It is possible that it is an issue of interplay between various plugins, as I do load many |
Oh! I think I figured it out partially. I had been referencing Betterment rules in my local rubocop config file, but had failed to use the
Now that I've added that, it waffles between running I think a bug in the unscoped find rule may be to blame. Perhaps it is not deterministic? Anyhow, now that the config is loaded properly, it seems I can turn off the rule ( |
My CI failed with a RuboCop violation. So locally I ran:
This is a surprising and invalid result, since I saw the result of running rubocop on CI (which runs
check
).Instead of saying it "got no changes" it should have reported the new failures we are about to see below...
So I ran
force_update
:The
force_update
caught the change somehow, when theautocorrect
did not.The text was updated successfully, but these errors were encountered: