Last active
January 5, 2024 10:40
-
-
Save MaxymVlasov/da500c2b402dfea886e432234faff120 to your computer and use it in GitHub Desktop.
https://tinyurl.com/pre-commit-config <-- Short link to gist | More here --> https://pre-commit.com/hooks.html.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How to install: | |
# pre-commit install --install-hooks && pre-commit install --install-hooks -t commit-msg | |
# How temporary skip one of hooks: https://pre-commit.com/#temporarily-disabling-hooks | |
repos: | |
####### | |
# ALL # | |
####### | |
- repo: git://github.com/pre-commit/pre-commit-hooks | |
rev: v4.0.1 | |
hooks: | |
# Git style | |
- id: check-added-large-files | |
- id: check-merge-conflict | |
- id: check-vcs-permalinks | |
- id: forbid-new-submodules | |
- id: no-commit-to-branch | |
# Common errors | |
- id: check-yaml | |
args: [--allow-multiple-documents] | |
- id: end-of-file-fixer | |
- id: trailing-whitespace | |
args: [--markdown-linebreak-ext=md] | |
- id: check-executables-have-shebangs | |
# Cross platform | |
- id: check-case-conflict | |
- id: mixed-line-ending | |
args: [--fix=lf] | |
# Security | |
- id: detect-aws-credentials | |
args: ['--allow-missing-credentials'] | |
- id: detect-private-key | |
# Git style | |
# You can simplify this process, installing commitizen globally and then add alias: | |
# sudo pip3 install -U Commitizen | |
# gcz='cz commit' | |
# https://github.com/commitizen-tools/commitizen#installation | |
- repo: https://github.com/commitizen-tools/commitizen | |
rev: master | |
hooks: | |
- id: commitizen | |
stages: [commit-msg] | |
- repo: https://github.com/milin/giticket | |
rev: '868d937' | |
hooks: | |
- id: giticket | |
args: ['--format={ticket}: {commit_msg}'] | |
- repo: https://github.com/jorisroovers/gitlint | |
rev: v0.12.0 | |
hooks: | |
- id: gitlint | |
# More security | |
- repo: https://github.com/mattlqx/pre-commit-sign | |
rev: v1.1.1 | |
hooks: | |
- id: sign-commit | |
############# | |
# TERRAFORM # | |
############# | |
- repo: git://github.com/antonbabenko/pre-commit-terraform | |
rev: v1.31.0 | |
hooks: | |
- id: terraform_fmt | |
- id: terraform_docs | |
- id: terraform_validate | |
############## | |
# TERRAGRUNT # | |
############## | |
- repo: https://github.com/gruntwork-io/pre-commit | |
rev: v0.1.12 | |
hooks: | |
- id: terragrunt-hclfmt | |
######## | |
# CHEF # | |
######## | |
# - repo: https://github.com/belminf/pre-commit-chef # Need installed 'gem'. sudo apt install ruby. And then fail | |
# rev: v0.1.1 | |
# hooks: | |
# - id: cookstyle | |
# - id: foodcritic | |
# args: | |
# - --tags ~chef15 | |
# - --epic-fail chef14 | |
- repo: https://github.com/mattlqx/pre-commit-ruby | |
rev: v1.2.6 | |
hooks: | |
- id: rubocop | |
- id: foodcritic | |
- id: rspec | |
- id: chef-cookbook-version | |
- repo: https://github.com/pre-commit/mirrors-ruby-lint # Need installed 'gem'. sudo apt install ruby | |
rev: v2.3.1-1 | |
hooks: | |
- id: ruby-lint | |
########## | |
# PYTHON # | |
########## | |
- repo: https://github.com/asottile/reorder_python_imports | |
rev: v2.2.0 | |
hooks: | |
- id: reorder-python-imports | |
language_version: python3 | |
- repo: https://github.com/asottile/add-trailing-comma | |
rev: v2.0.1 | |
hooks: | |
- id: add-trailing-comma | |
language_version: python3 | |
- repo: https://github.com/pre-commit/mirrors-autopep8 | |
rev: v1.5.2 | |
hooks: | |
- id: autopep8 | |
language_version: python3 | |
args: | |
- -i | |
- --max-line-length=100 | |
# Usage: http://pylint.pycqa.org/en/latest/user_guide/message-control.html | |
- repo: https://github.com/PyCQA/pylint | |
rev: pylint-2.5.2 | |
hooks: | |
- id: pylint | |
language_version: python3 | |
args: | |
- --disable=import-error # E0401. Locally you could not have all imports. | |
- --disable=fixme # W0511. 'TODO' notations. | |
- --disable=bad-continuation # Will be removed in pylint-2.6.0. Use wemake-python-styleguide. | |
- --disable=logging-fstring-interpolation # Conflict with "use a single formatting" WPS323 | |
- repo: https://github.com/pre-commit/mirrors-mypy | |
rev: v0.770 | |
hooks: | |
- id: mypy | |
language_version: python3 | |
args: [ | |
--ignore-missing-imports, | |
--disallow-untyped-calls, | |
--warn-redundant-casts, | |
] | |
- repo: https://gitlab.com/pycqa/flake8.git | |
rev: 3.8.2 | |
hooks: | |
- id: flake8 | |
language_version: python3 | |
additional_dependencies: | |
- flake8-2020 | |
- flake8-docstrings | |
- flake8-pytest-style | |
- wemake-python-styleguide | |
args: | |
- --max-returns=2 # Default settings | |
- --max-arguments=4 # Default settings | |
# https://www.flake8rules.com/ | |
# https://wemake-python-stylegui.de/en/latest/pages/usage/violations/index.html | |
- --extend-ignore= | |
WPS305, <!-- Found `f` string --> | |
E501, <!-- line too long (> 79 characters). Use 100 --> | |
I, <!-- opt out of using isort in favor of reorder-python-imports --> | |
RST, <!-- Conflict with DAR --> | |
######### | |
# SHELL # (AND OTHER) | |
######### | |
# - repo: https://github.com/jumanjihouse/pre-commit-hooks | |
# rev: 2.1.6 | |
# hooks: | |
# - id: git-check # Configure in .gitattributes | |
# - id: git-dirty # Configure in .gitignore | |
# - id: markdownlint # Configure in .mdlrc | |
# - id: require-ascii | |
# - id: script-must-have-extension | |
# - id: script-must-not-have-extension | |
# - id: shellcheck | |
# - id: shfmt | |
# args: ['-l', '-i', '2', '-ci', '-sr', '-w'] | |
# exclude: | | |
# (?x) | |
# # Comment | |
# (path/to/file/one | |
# # Comment 2 | |
# |another/file.sh | |
# ) | |
- repo: git://github.com/detailyang/pre-commit-shell | |
rev: v1.0.6 | |
hooks: | |
- id: shell-lint | |
args: [--format=json] | |
- repo: https://github.com/syntaqx/git-hooks | |
rev: v0.0.17 | |
hooks: | |
- id: forbid-binary | |
- id: shellcheck | |
- id: shfmt | |
- repo: https://github.com/openstack/bashate | |
rev: 2.0.0 | |
hooks: | |
- id: bashate | |
language_version: python3 | |
args: | |
- --max-line-length=100 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Git style-guide (partially outdated) - https://github.com/pdffiller/styleguide-hooks#style-guide
Bash and Terraform Styleguide - https://github.com/shalb/cluster.dev/blob/master/docs/style-guide.md