Skip to content

Commit

Permalink
Added pre-commit configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
azmeuk authored and tobixen committed Jun 30, 2022
1 parent 73675ff commit 5d69724
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,12 @@ jobs:
key: pip|${{ hashFiles('setup.py') }}|${{ hashFiles('tox.ini') }}
- run: pip install tox
- run: tox -e docs
style:
runs-on: ubuntu-latest
steps:
- uses: actions/cache@v1
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ hashFiles('.pre-commit-config.yaml') }}
- run: pip install tox
- run: tox -e style
17 changes: 17 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
repos:
- repo: https://github.com/asottile/reorder_python_imports
rev: v3.1.0
hooks:
- id: reorder-python-imports
args: ["--application-directories", "src"]
- repo: https://github.com/psf/black
rev: 22.6.0
hooks:
- id: black
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-byte-order-marker
- id: trailing-whitespace
- id: end-of-file-fixer
7 changes: 6 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox:tox]
envlist = py37,py38,py39,py310,docs
envlist = py37,py38,py39,py310,docs,style

[testenv]
deps = --editable .[test]
Expand All @@ -15,5 +15,10 @@ source-dir = docs/source
build-dir = docs/build
all_files = 1

[testenv:style]
deps = pre-commit
skip_install = true
commands = pre-commit run --all-files --show-diff-on-failure

[upload_sphinx]
upload-dir = docs/build/html

0 comments on commit 5d69724

Please sign in to comment.