mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 02:36:17 +03:00
Run lint with pre-commit
This commit is contained in:
parent
a003658cce
commit
995707f3ad
17
.github/workflows/lint.yml
vendored
17
.github/workflows/lint.yml
vendored
|
@ -15,6 +15,22 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- 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 }}
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
uses: actions/setup-python@v1
|
uses: actions/setup-python@v1
|
||||||
with:
|
with:
|
||||||
|
@ -30,3 +46,4 @@ jobs:
|
||||||
|
|
||||||
- name: Lint
|
- name: Lint
|
||||||
run: tox -e lint
|
run: tox -e lint
|
||||||
|
|
||||||
|
|
32
.pre-commit-config.yaml
Normal file
32
.pre-commit-config.yaml
Normal 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
|
|
@ -1,6 +1,9 @@
|
||||||
dist: xenial
|
dist: xenial
|
||||||
language: python
|
language: python
|
||||||
cache: pip
|
cache:
|
||||||
|
pip: true
|
||||||
|
directories:
|
||||||
|
- $HOME/.cache/pre-commit
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
irc: "chat.freenode.net#pil"
|
irc: "chat.freenode.net#pil"
|
||||||
|
|
|
@ -6,6 +6,7 @@ include *.py
|
||||||
include *.rst
|
include *.rst
|
||||||
include *.sh
|
include *.sh
|
||||||
include *.txt
|
include *.txt
|
||||||
|
include *.yaml
|
||||||
include LICENSE
|
include LICENSE
|
||||||
include Makefile
|
include Makefile
|
||||||
include tox.ini
|
include tox.ini
|
||||||
|
|
8
tox.ini
8
tox.ini
|
@ -24,13 +24,9 @@ deps =
|
||||||
|
|
||||||
[testenv:lint]
|
[testenv:lint]
|
||||||
commands =
|
commands =
|
||||||
black --target-version py35 --check --diff .
|
pre-commit run --all-files
|
||||||
flake8 --statistics --count
|
|
||||||
isort --check-only --diff
|
|
||||||
check-manifest
|
check-manifest
|
||||||
deps =
|
deps =
|
||||||
black
|
pre-commit
|
||||||
check-manifest
|
check-manifest
|
||||||
flake8
|
|
||||||
isort
|
|
||||||
skip_install = true
|
skip_install = true
|
||||||
|
|
Loading…
Reference in New Issue
Block a user