From 5f51f1896844fd3ee75a6fae615a2d638de5c3c6 Mon Sep 17 00:00:00 2001 From: Martin Eigenmann Date: Mon, 11 Oct 2021 09:49:29 +0200 Subject: [PATCH] feat: add black, flake config and pre-commit --- .flake8 | 3 +++ .github/workflows/python-test.yml | 12 +++++------- .pre-commit-config.yaml | 19 +++++++++++++++++++ 3 files changed, 27 insertions(+), 7 deletions(-) create mode 100644 .flake8 create mode 100644 .pre-commit-config.yaml diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..c2fdddc --- /dev/null +++ b/.flake8 @@ -0,0 +1,3 @@ +[flake8] +max-complexity = 10 +select = E9,F63,F7,F82 diff --git a/.github/workflows/python-test.yml b/.github/workflows/python-test.yml index 6136ef1..d180b71 100644 --- a/.github/workflows/python-test.yml +++ b/.github/workflows/python-test.yml @@ -22,14 +22,12 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install flake8 pytest coverage - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - - name: Lint with flake8 + pip install pipenv==v2021.5.29 + pipenv install --dev --deploy + - name: Lint with black and flake run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + black --check icalevents + flake8 . --count --exit-zero - name: Test with pytest run: | coverage run test.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..1b47c3c --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,19 @@ +ci: + skip: [pylint] + +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v2.3.0 + hooks: + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace + - repo: https://github.com/psf/black + rev: 21.9b0 + hooks: + - id: black + args: ['--check'] + - repo: https://gitlab.com/pycqa/flake8 + rev: 3.7.9 + hooks: + - id: flake8