Run lint with pre-commit

This commit is contained in:
Hugo 2020-02-05 17:59:04 +02:00
parent a003658cce
commit 995707f3ad
5 changed files with 56 additions and 7 deletions

View File

@ -15,6 +15,22 @@ jobs:
steps:
- uses: actions/checkout@v1
- name: pip cache
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: lint-pip-${{ hashFiles('**/setup.py') }}
restore-keys: |
lint-pip-
- name: pre-commit cache
uses: actions/cache@v1
with:
path: ~/.cache/pre-commit
key: lint-pre-commit-${{ hashFiles('**/.pre-commit-config.yaml') }}
restore-keys: |
lint-pre-commit-
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
@ -30,3 +46,4 @@ jobs:
- name: Lint
run: tox -e lint

32
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,32 @@
repos:
- repo: https://github.com/psf/black
rev: 19.10b0
hooks:
- id: black
args: ["--target-version", "py35"]
# Only .py files, until https://github.com/psf/black/issues/402 resolved
files: \.py$
types: []
- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.9
hooks:
- id: flake8
additional_dependencies: [flake8-2020, flake8-implicit-str-concat]
- repo: https://github.com/timothycrosley/isort
rev: 4.3.21
hooks:
- id: isort
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.5.1
hooks:
- id: python-check-blanket-noqa
- id: rst-backticks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.5.0
hooks:
- id: check-merge-conflict
- id: check-yaml

View File

@ -1,6 +1,9 @@
dist: xenial
language: python
cache: pip
cache:
pip: true
directories:
- $HOME/.cache/pre-commit
notifications:
irc: "chat.freenode.net#pil"

View File

@ -6,6 +6,7 @@ include *.py
include *.rst
include *.sh
include *.txt
include *.yaml
include LICENSE
include Makefile
include tox.ini

View File

@ -24,13 +24,9 @@ deps =
[testenv:lint]
commands =
black --target-version py35 --check --diff .
flake8 --statistics --count
isort --check-only --diff
pre-commit run --all-files
check-manifest
deps =
black
pre-commit
check-manifest
flake8
isort
skip_install = true