You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I call ruff . it finished in 0.15s on my repo, but ruff --fix . takes >2.5s, even if there are no lint errors and nothing to fix. Is it safe to always call ruff . and run it again with --fix only when the are some fixable issues? If so then maybe there is some room for improvement in ruff itself?
My use case was that we have replaced isort (and few other tools) with ruff --fix and it is much faster, but I was looking into speeding it up even more. We run black && ruff --fix, black takes 0.8s and I hoped to speed it up with ruff format, but then noticed that ruff --fix takes most of the execution time.
The text was updated successfully, but these errors were encountered:
Let me look into this… I think we might be intentionally skipping the cache when the linter is run with the fix flag, but that may no longer be necessary for a variety of reasons. At least, I don’t see an inherent reason why we need to skip the cache any more.
But yes — you can always run ruff with fix after running ruff, only if there are any fixable issues.
## Summary
If a file has no diagnostics, then we can read and write that
information from and to the cache, even if the fix mode is `--fix` or
`--diff`. (Typically, we can't read or write such results from or to the
cache, because `--fix` and `--diff` have side effects that take place
during diagnostic analysis (writing to disk or outputting the diff).)
This greatly improves performance when running `--fix` on a codebase in
the common case (few diagnostics).
Closes#8311.
Closes#8315.
When I call
ruff .
it finished in 0.15s on my repo, butruff --fix .
takes >2.5s, even if there are no lint errors and nothing to fix. Is it safe to always callruff .
and run it again with --fix only when the are some fixable issues? If so then maybe there is some room for improvement in ruff itself?My use case was that we have replaced isort (and few other tools) with ruff --fix and it is much faster, but I was looking into speeding it up even more. We run black && ruff --fix, black takes 0.8s and I hoped to speed it up with
ruff format
, but then noticed that ruff --fix takes most of the execution time.The text was updated successfully, but these errors were encountered: