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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
make --parallel and --auto-correct work together #10613
Comments
@marcandre asked about the same thing here but it was never answered. I think the reason why we've disabled parallel execution for autocorrection is that it's not trivial to get it to work consistently. Just removing the lines rubocop/lib/rubocop/options.rb Lines 426 to 428 in 8fa156c
rubocop -a -P is always a long row of green dots. I.e., we don't see any indication of offenses that were found and corrected. So the normal algorithm for parallel execution, which is to warm up the cache in parallel and then do the inspection in a single thread, doesn't fulfill the needs of autocorrection.
|
Allow the `-P`/`--parallel` flag together with the autocorrection flags `--[safe-]auto-correct`/`-a` `--auto-correct-all`/`-A` and `--fix-layout`. Also make this the default, so that `--no-parallel` has to be given for a single core run. The algorithm for normal parallel inspection is followed, so that a cache warm-up phase is run first. This phase only does caching of inspection results. It doesn't update any files. Then it does a single core run that takes advantage of the cached results and does the corrections. The speed gain from this approach is probably smaller than writing files in parallel, but it's a pretty small change that still outputs correction results in the same way as before. Also fix the documentation for `--parallel`, which did not mention `--no-parallel`.
amazing! :D |
@grosser Thanks! I hope you read in the PR that it's a somewhat limited improvement that only guarantees that the cache is warm before starting to correct files. Sometimes that translates into a big gain in speed, sometimes it's a small one. 馃檪 |
I can do it with xargs, so we can also do it internally 馃し
... maybe it needs to say "rules xyz are not enforced because they would rename files" or whatever the reason was to disable this, but for 99% case they should just work! :)
The text was updated successfully, but these errors were encountered: