Skip to content

Instantly share code, notes, and snippets.

@loliee
Last active February 20, 2022 12:20
Show Gist options
  • Save loliee/17d0c154f6e334c9dab94053fa47d4da to your computer and use it in GitHub Desktop.
Save loliee/17d0c154f6e334c9dab94053fa47d4da to your computer and use it in GitHub Desktop.
A pre-commit config file using docker
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.4.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-symlinks
- id: check-yaml
- id: debug-statements
- id: detect-private-key
- id: flake8
args: ["--ignore=E501"]
- id: requirements-txt-fixer
- id: trailing-whitespace
- repo: https://github.com/ansible/ansible-lint
rev: v4.2.0
hooks:
- id: ansible-lint
exclude: ansible/group_vars|ansible/vault_vars
- repo: https://github.com/adrienverge/yamllint
rev: v1.20.0
hooks:
- id: yamllint
name: Run yamllint
description: Lint yaml files
- repo: local
hooks:
- id: docker-prettier
name: Run prettier with docker
entry: mohrere/prettier:2.0.2 -c
language: docker_image
files: "\\.(\
css|less|scss\
|graphql|gql\
|html\
|js|jsx\
|json\
|md|markdown|mdown|mkdn\
|mdx\
|ts|tsx\
|vue\
|yaml|yml\
)$"
- id: docker-hadolint
name: Run hadolint with docker
language: docker_image
entry: hadolint/hadolint:v1.7.0 hadolint --ignore DL3003 --ignore DL3008 --ignore SC1117
files: Dockerfile
- id: docker-markdownlint
name: Run markdownlint with docker
language: docker_image
entry: markdownlint/markdownlint
types: [markdown]
- id: docker-shell-lint
name: Run shellcheck with docker
language: docker_image
entry: koalaman/shellcheck:stable
types: [shell]
- id: docker-shell-shfmt
name: Run shfmt with docker
language: docker_image
entry: mvdan/shfmt -d -i 2
types: [shell]
- id: check-vaulted-files
name: Check ansible vaulted files
description: Check that all files are correctly encrypted
entry: bash -c 'find "$@" -type f | xargs -I{} grep -L "ANSIBLE_VAULT;1.1;AES256" {}' --
language: system
files: ansible/vault_vars|ansible/vault_files
types: [file]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment