diff options
author | Sorin Sbarnea <ssbarnea@redhat.com> | 2020-01-07 20:46:18 +0000 |
---|---|---|
committer | Sorin Sbarnea <ssbarnea@redhat.com> | 2020-01-14 13:42:59 +0000 |
commit | e9cd3319cf14b3d9484c4e6d7aa5040509a81653 (patch) | |
tree | 522210d5972a9de60223b062a68d4770debb232b /Makefile | |
parent | 6c3d383b50439058c57b9f3235643aaf168d3148 (diff) | |
download | podman-e9cd3319cf14b3d9484c4e6d7aa5040509a81653.tar.gz podman-e9cd3319cf14b3d9484c4e6d7aa5040509a81653.tar.bz2 podman-e9cd3319cf14b3d9484c4e6d7aa5040509a81653.zip |
Enable pre-commit tool linting
This should help use keep the codebase more consistent, and avoid sevel
whitespace related issues, or bad file permissions.
pre-commit allows us to easily introduce other linters in follow-ups,
like bashate.
Note: pre-commit tool does *not* install any git-hooks. Making commits
will will call the tool unless you deliverately tell it to install the
hooks.
Signed-off-by: Sorin Sbarnea <ssbarnea@redhat.com>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -32,8 +32,10 @@ BUILDTAGS ?= \ exclude_graphdriver_devicemapper \ seccomp \ varlink -PYTHON ?= $(shell command -v python python3|head -n1) +PYTHON ?= $(shell command -v python3 python|head -n1) PKG_MANAGER ?= $(shell command -v dnf yum|head -n1) +# ~/.local/bin is not in PATH on all systems +PRE_COMMIT = $(shell command -v bin/venv/bin/pre-commit ~/.local/bin/pre-commit pre-commit | head -n1) SOURCES = $(shell find . -name "*.go") @@ -149,6 +151,11 @@ endif touch $@ lint: golangci-lint +ifeq ($(PRE_COMMIT),) + @echo "FATAL: pre-commit was not found, check https://pre-commit.com/ about installing it." >&2 + @exit 2 +endif + $(PRE_COMMIT) run -a golangci-lint: .gopathok varlink_generate .install.golangci-lint $(GOBIN)/golangci-lint run --tests=false --skip-files swagger.go |