Skip to content
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

Merged
merged 5 commits into from Dec 24, 2022

Conversation

squiddy
Copy link
Contributor

@squiddy squiddy commented Dec 23, 2022

Refs #1313

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() {
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Member

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?

pyproject.toml Outdated Show resolved Hide resolved
@charliermarsh charliermarsh merged commit 102b049 into astral-sh:main Dec 24, 2022
@squiddy squiddy deleted the cache-dir branch December 27, 2022 05:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants