Add support for running pyanalyze as a Pre-Commit hook
See original GitHub issueAs I’m sure you’re aware, Pre-Commit is a popular Python/cross-language hooks framework for managing variety of checking, linting, formatting and other tools automatically, on demand in in CIs. Adding a minimal .pre-commit-hooks.yaml
file in the root of the repo with a few lines of config will allow other projects to easily adopt pyanalyze, either locally or on CI, by simply pasting a couple-line snippet into their .pre-commit-config.yaml
file, and pre-commit will install, run and update pyanalyze automagically, making it much easier to adopt, configure and maintain.
I’d be happy to add this in a PR if you don’t object; I’d also document it with the standard snippit in the README. Once this goes in (as well as PR #215 ), it would be nice to have a release sometime soon so we can start taking advantage of it. Thanks!
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Thanks for looking into this! Yes, pyanalyze relies on actually importing the code it checks. Some sys.path hackery may make the pre-commit hook work, but I haven’t tried myself. One of the items on my to-do list is to make it easier to run pyanalyze on arbitrary projects without too much sys.path hackery.
The next one should be 0.3.0. I imagine I’m going to just go with
0.x.0
for a while.