From b117fb1833bae530e3448b2ef3d197018bac68ce Mon Sep 17 00:00:00 2001 From: Brutus Date: Thu, 29 Jul 2021 11:08:19 +0200 Subject: [PATCH] :wrench: add pre-comit config --- .editorconfig | 4 +++ .pre-commit-config.yaml | 58 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.editorconfig b/.editorconfig index a3000687..89141acb 100644 --- a/.editorconfig +++ b/.editorconfig @@ -12,6 +12,10 @@ trim_trailing_whitespace = true indent_size = 4 indent_style = tab +[*.yaml] +indent_size = 2 +indent_style = space + [*.js] indent_size = 2 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..e0b75fe1 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,58 @@ +--- +# INSTALL .: `pre-commit install --overwrite --install-hooks` +# UPDATE ..: `pre-commit autoupdate` +default_language_version: + python: python3.8 +exclude: '\.svg$' +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.0.1 + hooks: + # Generall Stuff + - id: trailing-whitespace + - id: mixed-line-ending + args: + - "--fix=lf" + - id: end-of-file-fixer + # VCS + - id: check-merge-conflict + # Config / Data Files + - id: check-yaml + # Python + - id: debug-statements + - id: requirements-txt-fixer + # Prettier (HTML, JS, CSS, Markdown…) + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v2.3.2 + hooks: + - id: prettier + # exclude HTML templates (no Jinja2 support) + exclude: 'source/_templates/.*\.html' + # YAML + - repo: https://github.com/adrienverge/yamllint.git + rev: v1.26.1 + hooks: + - id: yamllint + # Python: check syntax + - repo: https://github.com/pycqa/flake8 + rev: 3.9.2 + hooks: + - id: flake8 + args: + - "--select=F" + # Python: reorder imports + - repo: https://github.com/asottile/reorder_python_imports + rev: v2.6.0 + hooks: + - id: reorder-python-imports + args: + - "--application-directories=.:source" + - "--py38-plus" + # Python: lint with black + - repo: https://github.com/psf/black + rev: 21.7b0 + hooks: + - id: black + args: + - "--line-length=88" + - "--target-version=py38"