Add pre-commit to run vint

This commit is contained in:
ViViDboarder 2019-10-24 12:35:49 -07:00
parent 16d6dd2ce5
commit 2b6b13fcda
3 changed files with 32 additions and 0 deletions

1
.gitignore vendored
View File

@ -12,3 +12,4 @@ vim/tmp/
vim/tmp/viminfo.*
.DS_Store
vim/view/
.pre_commit_env/

12
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,12 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v1.2.3
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
# After merging, this should change to the upstream and point to master
- repo: https://github.com/ViViDboarder/vint
rev: pre-commit-support
hooks:
- id: vint

View File

@ -1,3 +1,6 @@
PRE_COMMIT_ENV ?= .pre_commit_env
PRE_COMMIT_ENV_BIN ?= $(PRE_COMMIT_ENV)/bin
.PHONY: default
default: install
@ -21,3 +24,19 @@ uninstall:
clean:
rm -fr ./vim/plugged
rm -fr ./vim/autoload/plug.vim
# Installs pre-commit hooks
$(PRE_COMMIT_ENV):
virtualenv $(PRE_COMMIT_ENV)
$(PRE_COMMIT_ENV_BIN)/pre-commit: $(PRE_COMMIT_ENV)
$(PRE_COMMIT_ENV_BIN)/pip install pre-commit
.PHONY: install-hooks
install-hooks: $(PRE_COMMIT_ENV_BIN)/pre-commit
$(PRE_COMMIT_ENV_BIN)/pre-commit install-hooks
# Checks files for encryption
.PHONY: check
check: $(PRE_COMMIT_ENV_BIN)/pre-commit
$(PRE_COMMIT_ENV_BIN)/pre-commit run --all-files