skylab
/
skylab-ansible
Archived
2
0
Fork 0

Update precommit config to use local hooks

This commit is contained in:
Ethan Paul 2021-08-30 22:45:56 -04:00
parent 6889dc2f26
commit 43ccda1ef2
No known key found for this signature in database
GPG Key ID: 6A337337DF6B5B1A
1 changed files with 26 additions and 20 deletions

View File

@ -1,28 +1,34 @@
---
# All of the pre-commit hooks here actually use the `pytyhon` pre-commit language
# setting. However, for the python language setting, pre-commit will create and manage
# a cached virtual environment for each hook ID and do a bare `pip install <repo>` into
# the venv to setup the hook. This can result in conflicting dependency versions between
# the version installed to the pre-commit venv and the version installed to the Poetry
# venv specified in the lockfile.
#
# The solution is to specify `language: system` for all hooks and then install the
# required dependencies to the Poetry venv. The `system` language skips the isolated
# venv creation and looks for the entrypoint specified by the hook in the global
# environment which, if running in the Poetry venv, will find the entrypoint provided
# by the Poetry-managed dependency.
#
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.3.0
- repo: local
hooks:
- id: end-of-file-fixer
name: end-of-file-fixer
entry: end-of-file-fixer
language: system
- id: fix-encoding-pragma
args:
- "--remove"
language: system
- id: trailing-whitespace
types:
- text
- id: trailing-whitespace-fixer
name: trailing-whitespace-fixer
entry: trailing-whitespace-fixer
language: system
types:
- text
- id: check-merge-conflict
name: check-merge-conflict
entry: check-merge-conflict
language: system
types:
- text
- id: mdformat
name: mdformat
entry: mdformat
language: system
args:
- "--number"
- "--wrap=90"
types:
- markdown