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 #8621] Helpful Infinite Loop message #8701
Conversation
The proposed changes look good to me overall. Let's also hear what @marcandre and @koic think about them, though. |
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.
Fabulous!
Only nitpick is that I would convert an array to string with .join(', ')
instead of .to_s
. In the typical cases, Some/Cop -> Some/OtherCop
is nicer than [Some/Cop] -> [Some/OtherCop]
.
@marcandre So in case of more than 1 conflicting cop it should be P.S: Updated it already |
7a62839
to
a8b2a79
Compare
Closes rubocop#8621 Adds the information about which Cops exactly caused an infinite loop
Cool, LGTM 👍 |
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 looks good to me. I think this information can be a good hint to solve the infinite loop error 👍
Thanks! |
Closes #8621
Adds the information about which Cops exactly caused an infinite loop
Tracks the corrected offenses on each iteration.
In the case of exceeding
MAX_ITERATIONS
, it just returns cop names from the latest iteration.In the case of duplicated sources, it returns a list of iterations (with cop names) starting from the first time this exact source has already been generated. In most cases, I imagine there would only be 2 or 3 iterations between looped states but it should handle all cases.
Examples:
Test/ClassMustBeAModuleCop -> Test/ModuleMustBeAClassCop
Test/ClassMustBeAModuleCop, Test/AtoB -> Test/ModuleMustBeAClassCop, Test/BtoA
Test/AtoB -> Test/BtoC -> Test/CtoA
Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).bundle exec rake default
. It executes all tests and RuboCop for itself, and generates the documentation.