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