Skip to content

Commit

Permalink
Merge pull request #4407 from hugovk/lint-with-pre-commit
Browse files Browse the repository at this point in the history
Run lint with pre-commit
  • Loading branch information
hugovk committed Mar 22, 2020
2 parents a003658 + 995707f commit 7028de7
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 7 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -30,3 +46,4 @@ jobs:
- name: Lint
run: tox -e lint

32 changes: 32 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
dist: xenial
language: python
cache: pip
cache:
pip: true
directories:
- $HOME/.cache/pre-commit

notifications:
irc: "chat.freenode.net#pil"
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ include *.py
include *.rst
include *.sh
include *.txt
include *.yaml
include LICENSE
include Makefile
include tox.ini
Expand Down
8 changes: 2 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 7028de7

Please sign in to comment.