summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-01-15 23:51:22 +0100
committerGitHub <noreply@github.com>2020-01-15 23:51:22 +0100
commite1e405b70d687897423d0d1c327efd9bea190dff (patch)
treed2abce1febe1bf7f2c2a8d741f0c4010d4cf5e2b
parent741e29caf39c57551724a48265f6d9641f8f6fe0 (diff)
parente9cd3319cf14b3d9484c4e6d7aa5040509a81653 (diff)
downloadpodman-e1e405b70d687897423d0d1c327efd9bea190dff.tar.gz
podman-e1e405b70d687897423d0d1c327efd9bea190dff.tar.bz2
podman-e1e405b70d687897423d0d1c327efd9bea190dff.zip
Merge pull request #4807 from ssbarnea/fix/pre-commit
Enable pre-commit linting
-rw-r--r--.pre-commit-config.yaml12
-rw-r--r--[-rwxr-xr-x]API.md0
-rw-r--r--Makefile9
-rw-r--r--contrib/gate/Dockerfile1
-rw-r--r--contrib/snapcraft/.editorconfig2
-rw-r--r--docs/source/Commands.rst2
-rw-r--r--docs/source/network.rst2
-rw-r--r--docs/source/volume.rst2
-rw-r--r--test/install/.gitignore2
-rw-r--r--test/install/README.md2
-rw-r--r--test/trust_set_test.json2
11 files changed, 28 insertions, 8 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 000000000..4de8e4c12
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,12 @@
+---
+exclude: ^vendor/
+repos:
+ - repo: https://github.com/pre-commit/pre-commit-hooks.git
+ rev: v2.4.0
+ hooks:
+ - id: end-of-file-fixer
+ - id: trailing-whitespace
+ - id: mixed-line-ending
+ - id: check-byte-order-marker
+ - id: check-executables-have-shebangs
+ - id: check-merge-conflict
diff --git a/API.md b/API.md
index ca71fdf9e..ca71fdf9e 100755..100644
--- a/API.md
+++ b/API.md
diff --git a/Makefile b/Makefile
index a02706eaf..62ed1e21f 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/contrib/gate/Dockerfile b/contrib/gate/Dockerfile
index c6aacead5..2a904a202 100644
--- a/contrib/gate/Dockerfile
+++ b/contrib/gate/Dockerfile
@@ -46,6 +46,7 @@ WORKDIR $GOSRC
# Install dependencies
RUN set -x && \
install -D -m 755 $GOSRC/contrib/gate/entrypoint.sh /usr/local/bin/ && \
+ python3 -m pip install pre-commit && \
rm -rf "$GOSRC"
# Install cni config
diff --git a/contrib/snapcraft/.editorconfig b/contrib/snapcraft/.editorconfig
index 1749b2d4c..89bc6dc80 100644
--- a/contrib/snapcraft/.editorconfig
+++ b/contrib/snapcraft/.editorconfig
@@ -14,4 +14,4 @@ indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
-insert_final_newline = true \ No newline at end of file
+insert_final_newline = true
diff --git a/docs/source/Commands.rst b/docs/source/Commands.rst
index 276a9c4fb..028f03429 100644
--- a/docs/source/Commands.rst
+++ b/docs/source/Commands.rst
@@ -104,4 +104,4 @@ Commands
:doc:`volume <volume>` Manage volumes
-:doc:`wait <markdown/podman-wait.1>` Block on one or more containers \ No newline at end of file
+:doc:`wait <markdown/podman-wait.1>` Block on one or more containers
diff --git a/docs/source/network.rst b/docs/source/network.rst
index c1c53bc34..d96e00a7d 100644
--- a/docs/source/network.rst
+++ b/docs/source/network.rst
@@ -7,4 +7,4 @@ Network
:doc:`ls <markdown/podman-network-ls.1>` network list
-:doc:`rm <markdown/podman-network-rm.1>` network rm \ No newline at end of file
+:doc:`rm <markdown/podman-network-rm.1>` network rm
diff --git a/docs/source/volume.rst b/docs/source/volume.rst
index 43fe87054..a966feafd 100644
--- a/docs/source/volume.rst
+++ b/docs/source/volume.rst
@@ -8,4 +8,4 @@ Volume
:doc:`prune <markdown/podman-volume-prune.1>` Remove all unused volumes
-:doc:`rm <markdown/podman-volume-rm.1>` Remove one or more volumes \ No newline at end of file
+:doc:`rm <markdown/podman-volume-rm.1>` Remove one or more volumes
diff --git a/test/install/.gitignore b/test/install/.gitignore
index 0a948f916..fc29e5c69 100644
--- a/test/install/.gitignore
+++ b/test/install/.gitignore
@@ -1 +1 @@
-rpms/ \ No newline at end of file
+rpms/
diff --git a/test/install/README.md b/test/install/README.md
index 21e5ab26d..7150314a6 100644
--- a/test/install/README.md
+++ b/test/install/README.md
@@ -8,4 +8,4 @@ make -f .copr/Makefile srpm outdir=test/install/rpms
make -f .copr/Makefile build_binary outdir=test/install/rpms
```
-Then, run a container image build using the Dockerfiles in this directory. \ No newline at end of file
+Then, run a container image build using the Dockerfiles in this directory.
diff --git a/test/trust_set_test.json b/test/trust_set_test.json
index 661e65922..f1fdf779c 100644
--- a/test/trust_set_test.json
+++ b/test/trust_set_test.json
@@ -5,4 +5,4 @@
}
],
"transports": null
-} \ No newline at end of file
+}