weixin_39804631
2021-01-12 14:59 阅读 2

pre-commit should meet the XDG Base Directory Specification

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

该提问来源于开源项目:pre-commit/pre-commit

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

5条回答 默认 最新

  • weixin_39955149 weixin_39955149 2021-01-12 14:59

    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?)

    点赞 评论 复制链接分享
  • weixin_39804631 weixin_39804631 2021-01-12 14:59

    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: - the official Python release for Windows; - Cygwin; - WSL; - all of the above?

    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.); 1. 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.

    点赞 评论 复制链接分享
  • weixin_39955149 weixin_39955149 2021-01-12 14:59

    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 :)
    点赞 评论 复制链接分享
  • weixin_39804631 weixin_39804631 2021-01-12 14:59

    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?

    点赞 评论 复制链接分享
  • weixin_39955149 weixin_39955149 2021-01-12 14:59

    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)

    点赞 评论 复制链接分享

相关推荐