Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 8 additions & 23 deletions .github/workflows/format-and-fail.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,15 @@
name: Format-and-Fail
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
branches:
- main

jobs:
Black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: psf/black@stable
with:
options: --check --verbose
version: ~= 23.1.0
ISort:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: isort/isort-action@master
with:
configuration: --check-only --diff
requirementsFiles: pyproject.toml
Ruff:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: chartboost/ruff-action@v1
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- uses: pre-commit/action@v3.0.0
73 changes: 73 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: name-tests-test
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-json
- id: check-case-conflict
- id: check-toml
- id: check-merge-conflict
- id: check-xml
- id: check-yaml
- id: end-of-file-fixer
- id: check-symlinks
- id: mixed-line-ending
- id: sort-simple-yaml
- id: fix-encoding-pragma
args:
- --remove
- id: pretty-format-json
args:
- --autofix

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: python-check-blanket-noqa
- id: python-check-mock-methods
- id: python-no-eval
- id: python-no-log-warn

- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
name: Run isort to sort imports
files: \.py$
# To keep consistent with the global isort skip config defined in setup.cfg
exclude: ^build/.*$|^.tox/.*$|^venv/.*$
args:
- --lines-after-imports=2
- --profile=black
- --line-length=80

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.286
hooks:
- id: ruff
types_or: [python, pyi, jupyter]
args:
- --fix
- --target-version=py311
- --select=B,C,E,F,W
- --line-length=80

- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8
args:
- --ignore=E203,E402,E501,E800,W503,W391,E261
- --select=B,C,E,F,W,T4,B9

- repo: https://github.com/psf/black
rev: 23.7.0
hooks:
- id: black
args:
- --safe
- --target-version=py311
- --line-length=80
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ BASEDIR=project

.PHONY: lint
lint:
black ${BASEDIR}/ test/
isort ${BASEDIR}/ test/
ruff ${BASEDIR}/ test/
pre-commit run --all-files

.PHONY: test
test:
Expand Down
Loading