Skip to content

Commit

Permalink
Update linting
Browse files Browse the repository at this point in the history
  • Loading branch information
reidjohnson committed Feb 25, 2024
1 parent da4bd0c commit 2d250ad
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 3 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,19 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black flake8 isort pytest pytest-cov
pip install black cython-lint flake8 isort pytest pytest-cov
pip install -r ./docs/sphinx_requirements.txt
pip install --verbose --editable .
- name: Check formatting with black
- name: Check Python formatting with black
run: |
black --line-length 99 --diff --color .
black --line-length=99 --check .
- name: Check Cython formatting with cython-lint
run: |
cython-lint --max-line-length=99 --ignore=E741 .
- name: Check import order with isort
run: |
isort --profile=black --line-length=99 --check .
Expand Down
25 changes: 25 additions & 0 deletions pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-case-conflict
- id: check-merge-conflict
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 24.2.0
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
name: isort (python)
- id: isort
name: isort (cython)
types: [cython]
- repo: https://github.com/MarcoGorelli/cython-lint
rev: v0.16.0
hooks:
- id: cython-lint
- id: double-quote-cython-strings
13 changes: 12 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ requires = [
]

[tool.black]
line-length = 100
line-length = 99
target_version = ['py38', 'py39', 'py310', 'py311', 'py312']
preview = true
exclude = '''
Expand All @@ -26,3 +26,14 @@ exclude = '''
| doc/auto_examples
)/
'''

[tool.cython-lint]
max-line-length = 99
ignore = ['E741']

[tool.isort]
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
line_length = 99

0 comments on commit 2d250ad

Please sign in to comment.