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

pre-commit should meet the XDG Base Directory Specification #562

Closed
nagromc opened this issue Jul 17, 2017 · 5 comments
Closed

pre-commit should meet the XDG Base Directory Specification #562

nagromc opened this issue Jul 17, 2017 · 5 comments
Labels

Comments

@nagromc
Copy link

nagromc commented Jul 17, 2017

XDG Base Directory Specification is quite common now. Just ls ~/.cache ~/.config ~/.local to realize it.

I think ~/.pre-commit should be moved to $XDG_CACHE_HOME or $HOME/.cache

https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

@asottile
Copy link
Member

Pull requests welcome, note that this also has to work well for windows which doesn't adhere to XDG.

I've been hesitant to move the directory as it'd be a bit awkward for current users (though perhaps clean can just be updated to remove both paths for some amount of time?)

@nagromc
Copy link
Author

nagromc commented Jul 18, 2017

Pull requests welcome, note that this also has to work well for windows which doesn't adhere to XDG.

Is there any documentation for pre-commit on Windows?

Is it supposed to run on:

On which Windows version is it supposed to run?

How do you proceed to test it on Windows? Do you use a VM or something?

I've been hesitant to move the directory as it'd be a bit awkward for current users (though perhaps clean can just be updated to remove both paths for some amount of time?)

I understand. But it won't break anything since it would just re-cache all the needed stuff, right? We can imagine three scenarios if ~/.pre-commit already exists:

  1. Move the existing ~/.pre-commit in $XDG_CACHE_HOME or $HOME/.cache, with or without warning (see 2.);
  2. Don't move the existing ~/.pre-commit, but display a warning before re-caching;
  3. Just re-cache the needed parts without displaying any message (and maybe delete the existing ~/.pre-commit) ¯\_(ツ)_/¯

Well, it has been done already with the transition from hooks.yaml to .pre-commit-hooks.yaml in some sort.

@asottile
Copy link
Member

@nagromc If you ^F windows on http://pre-commit.com you can see the current support matrix

It is tested automatically through appveyor -- my home desktop at home also runs windows so I often do more-difficult debugging on that.

As for the three solutions above:

  1. Isn't feasible -- virtualenvs are not relocatable (the shebangs contain full paths to the interpreter)
  2. A possibility, though...
  3. sounds best :)

@nagromc
Copy link
Author

nagromc commented Jul 18, 2017

OK I'll give it a try when I have time. Didn't know about AppVeyor.

And for the third solution, should we delete ~/.pre-commit?

@asottile
Copy link
Member

I think just leave it alone for the most part (unless pre-commit clean is run, we can include it in there for some amount of time and then after some amount of time pretend like it never existed)

droctothorpe pushed a commit to droctothorpe/pre-commit that referenced this issue Mar 23, 2022
…e-config

[pre-commit.ci] pre-commit autoupdate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants