pre-commit hook added + minor fixes

## pre-commit
pre-commit added to check

- `bash` files with bashate see #1109
- `yaml` files with yamlint see #1108
- `docker` files with hadolint see #1100

# hadolint

version of the linter added as a variable in the `Makefile`
This commit is contained in:
Romain
2020-07-11 17:06:00 +02:00
parent 5197709e9f
commit e2e1399cd7
3 changed files with 30 additions and 2 deletions

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

@@ -0,0 +1,27 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.1.0
hooks:
#- id: flake8
- id: check-yaml
files: .*\.(yaml|yml)$
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.23.0
hooks:
- id: yamllint
files: \.(yaml|yml)$
exclude: ^.travis
- repo: https://github.com/openstack-dev/bashate.git
rev: 2.0.0
hooks:
- id: bashate
- repo: local
hooks:
- id: hadolint
name: Hadolint linter
description: Runs Hadolint to check for Dockerfile best practices
language: system
types:
- dockerfile
entry: make lint-all

View File

@@ -26,6 +26,7 @@ ALL_IMAGES:=$(ALL_STACKS)
# Linter
HADOLINT="${HOME}/hadolint"
HADOLINT_VERSION="v1.18.0"
help:
# http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
@@ -88,7 +89,7 @@ lint-build-test-all: $(foreach I,$(ALL_IMAGES),lint/$(I) arch_patch/$(I) build/$
lint-install: ## install hadolint
@echo "Installing hadolint at $(HADOLINT) ..."
@curl -sL -o $(HADOLINT) "https://github.com/hadolint/hadolint/releases/download/v1.18.0/hadolint-$(shell uname -s)-$(shell uname -m)"
@curl -sL -o $(HADOLINT) "https://github.com/hadolint/hadolint/releases/download/$(HADOLINT_VERSION)/hadolint-$(shell uname -s)-$(shell uname -m)"
@chmod 700 $(HADOLINT)
@echo "Installation done!"
@$(HADOLINT) --version

View File

@@ -1,4 +1,5 @@
docker
pre-commit
pytest
recommonmark==0.5.0
requests
@@ -6,4 +7,3 @@ sphinx>=1.6
sphinx-intl
tabulate
transifex-client