diff options
author | 2020-03-04 19:54:47 -0800 | |
---|---|---|
committer | 2020-03-04 21:20:06 -0800 | |
commit | 21dcf7ae8bfc73aa72cedfa5638966284d602452 (patch) | |
tree | 696a574ed34199281f445d86b0d25151158a508b /.pre-commit-config.yaml | |
parent | Add more pre-commit hooks (diff) |
CI: run pre-commit hooks in CI
This also means flake8 will output to stdout in CI now. It didn't
before because it output to an XML format for publishing.
Pre-commit creates its own environment in which it installs hooks. To
speed up runs, the pipeline will cache this for use with future jobs.
The cache will update if .pre-commit-config.yaml changes.
The flake8 pre-commit hook invokes flake8 via `pipenv run flake8`. It's
normally useful to use pipenv here cause it ensures flake8 is invoked
within the context of the venv. However, in CI, there is no venv -
dependencies are installed directly to the system site-packages.
`pipenv run` does not work in such case because it tries to create a new
venv if one doesn't exist (it doesn't consider the system interpreter to
be a venv).
This workaround (okay, it's a hack) creates an executable shell script
which replaces the original pipenv binary. The shell script simply
ignores the first argument (i.e. ignores `run` in `pipenv run`) and
executes the rest of the arguments as a command. It essentially makes
`pipenv run flake8` equivalent to just having ran `flake8`. When
pre-commit executes pipenv, the aforementioned script is what will run.
Diffstat (limited to '.pre-commit-config.yaml')
0 files changed, 0 insertions, 0 deletions