From e371e2cc5cdf934d2c2fb359f920ea2375989171 Mon Sep 17 00:00:00 2001 From: stijndcl Date: Tue, 19 Jul 2022 21:12:04 +0200 Subject: [PATCH] Add pre-commit config, make tests a requirement for quality checks --- .github/workflows/python.yml | 6 ++--- .pre-commit-config.yaml | 44 ++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 75e7e92..dfa2eba 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -62,7 +62,7 @@ jobs: with: token: ${{ secrets.CODECOV }} linting: - needs: [dependencies] + needs: [tests] runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -82,7 +82,7 @@ jobs: - name: Linting run: flake8 typing: - needs: [dependencies] + needs: [tests] runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -102,7 +102,7 @@ jobs: - name: Typing run: mypy didier database formatting: - needs: [dependencies] + needs: [tests] runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..6380e4b --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,44 @@ +default_language_version: + python: python3.9.5 + +repos: +- repo: https://github.com/ambv/black + rev: 22.3.0 + hooks: + - id: black + +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.3.0 + hooks: + - id: check-json + - id: end-of-file-fixer + - id: pretty-format-json + - id: trailing-whitespace + +- repo: https://github.com/pycqa/isort + rev: 5.10.1 + hooks: + - id: isort + +- repo: https://github.com/PyCQA/autoflake + rev: v1.4 + hooks: + - id: autoflake + name: autoflake (python) + args: + - "--remove-all-unused-imports" + - "--in-place" + - "--ignore-init-module-imports" + +- repo: https://github.com/PyCQA/flake8 + rev: 4.0.1 + hooks: + - id: flake8 + additional_dependencies: + - "flake8-bandit" + - "flake8-bugbear" + - "flake8-docstrings" + - "flake8-dunder-all" + - "flake8-eradicate" + - "flake8-isort" + - "flake8-simplify"