Skip to content

Commit c851a9e

Browse files
committed
Add ruff formatter
Ruff line length Remove Python isort conflicts with ruff Try fixing the line length nicer ruff syntax in pyproject.toml Remove E203 from checking Remove explicit cmd line args from pre-commit config
1 parent 2ebbece commit c851a9e

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

.github/workflows/source.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ jobs:
2020
- name: PEP8
2121
run: |
2222
python3 -m pip install -U flake8
23-
python3 -m flake8 --exclude=thirdParty .
23+
# E203: checks that ':' is not preceded by a space
24+
# But the Ruff formatter has better logic for that
25+
python3 -m flake8 --extend-ignore=E203 --exclude=thirdParty .
2426
2527
static-analysis:
2628
runs-on: ubuntu-22.04

.pre-commit-config.yaml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,20 @@ repos:
8585
- id: pycln
8686
name: pycln (python)
8787

88-
# Sorts Python imports according to PEP8
89-
# https://www.python.org/dev/peps/pep-0008/#imports
90-
- repo: https://github.com/pycqa/isort
91-
rev: 8.0.1
88+
# # Sorts Python imports according to PEP8
89+
# # https://www.python.org/dev/peps/pep-0008/#imports
90+
# - repo: https://github.com/pycqa/isort
91+
# rev: 8.0.1
92+
# hooks:
93+
# - id: isort
94+
# name: isort (python)
95+
96+
- repo: https://github.com/astral-sh/ruff-pre-commit
97+
rev: v0.15.1
9298
hooks:
93-
- id: isort
94-
name: isort (python)
99+
- id: ruff-check
100+
args: [ --fix, --exit-non-zero-on-fix ]
101+
- id: ruff-format
95102

96103
# Python: Flake8 (checks only, does this support auto-fixes?)
97104
#- repo: https://github.com/PyCQA/flake8

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ requires = [
77
"pybind11>=2.13.0,<3.0.0"
88
]
99
build-backend = "setuptools.build_meta"
10+
11+
[tool.ruff]
12+
line-length = 79

0 commit comments

Comments
 (0)