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 cache-dir to command-line and pyproject.toml #1351
Conversation
src/main.rs
Outdated
let mut cache_enabled: bool = !cli.no_cache; | ||
if cache_enabled && cache::init().is_err() { | ||
if cache_enabled && cache::init(cache_dir).is_err() { |
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 think we may need to call cache::init
for every Settings
object now, since different files could end up using different cache directories.
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.
Not sure how to go about this. Was thinking at first to do that in commands::run before running lint_path. But not only would that then happen per file, it can also happen at the same time due to par_iter.
My only other idea is to initialize the cache at the beginning for all resolved settings, keeping track of that and checking that per file.
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 think the latter option probably makes sense, to initialize for all resolved settings once we’ve gathered them up.
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.
Conceptually it’d be nice to just do it in the cache setter (like, right before we write), but maybe that’s hard to get right in a multi-threaded context?
Refs #1313