Skip to content

Commit 6948efb

Browse files
committed
Use Ruff instead of other lint/formatting tools
1 parent 633e72c commit 6948efb

4 files changed

Lines changed: 35 additions & 73 deletions

File tree

.pre-commit-config.yaml

Lines changed: 8 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,12 @@
11
repos:
2-
- repo: https://github.com/psf/black
3-
rev: 26.3.1
4-
hooks:
5-
- id: black
6-
name: black
7-
description: "Black: The uncompromising Python code formatter"
8-
entry: black
9-
language: python
10-
language_version: python3
11-
minimum_pre_commit_version: 2.9.2
12-
require_serial: true
13-
types_or: [python, pyi]
14-
- id: black-jupyter
15-
name: black-jupyter
16-
description:
17-
"Black: The uncompromising Python code formatter (with Jupyter Notebook support)"
18-
entry: black
19-
language: python
20-
minimum_pre_commit_version: 2.9.2
21-
require_serial: true
22-
types_or: [python, pyi, jupyter]
23-
additional_dependencies: [".[jupyter]"]
24-
25-
- repo: https://github.com/pycqa/flake8
26-
rev: 7.3.0
27-
hooks:
28-
- id: flake8
29-
additional_dependencies:
30-
- flake8-bugbear
31-
- flake8-comprehensions
32-
- flake8-simplify
33-
34-
- repo: https://gitlab.com/kennon.mckeever/nbhooks
35-
rev: 1.0.1
36-
hooks:
37-
- id: nb-ensure-clean
38-
name: nb-ensure-clean
39-
description: Ensure that committed Jupyter notebooks contain no outputs.
40-
entry: nb-ensure-clean
41-
files: \.ipynb$
42-
language: python
43-
44-
- repo: https://github.com/asottile/pyupgrade
45-
rev: v3.21.2
46-
hooks:
47-
- id: pyupgrade
48-
args: [--py310-plus]
49-
50-
- repo: https://github.com/PyCQA/isort
51-
rev: 8.0.1
52-
hooks:
53-
- id: isort
54-
name: isort (python)
55-
args: [--add-import, "from __future__ import annotations"]
56-
types: [python]
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.15.8
4+
hooks:
5+
# Run the linter
6+
- id: ruff
7+
args: [ --fix ]
8+
# Run the formatter
9+
- id: ruff-format
5710

5811
- repo: https://github.com/pre-commit/pre-commit-hooks
5912
rev: v6.0.0
@@ -77,16 +30,6 @@ repos:
7730
.gitignore
7831
)
7932
80-
- repo: https://github.com/PyCQA/pydocstyle
81-
rev: 6.3.0
82-
hooks:
83-
- id: pydocstyle
84-
files: bmipy/.*\.py$
85-
args:
86-
- --convention=numpy
87-
- --add-select=D417
88-
additional_dependencies: [".[toml]"]
89-
9033
- repo: https://github.com/pre-commit/mirrors-mypy
9134
rev: v1.19.1
9235
hooks:

noxfile.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""Nox configuration."""
2+
13
from __future__ import annotations
24

35
import pathlib

pyproject.toml

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,31 @@ where = [
6969
[tool.coverage.run]
7070
relative_files = true
7171

72-
[tool.isort]
73-
known_first_party = "bmipy"
74-
profile = "black"
75-
force_single_line = true
72+
[tool.ruff.lint]
73+
select = [
74+
"B", # flake8-bugbear
75+
"C4", # flake8-comprehensions
76+
"C90", # mccabe
77+
"D", # pydocstyle
78+
"E", "W", # pycodestyle
79+
"F", # Pyflakes
80+
"FA", # flake8-future-annotations
81+
"I", # isort
82+
# "SIM", # flake8-simplify
83+
"UP", # pyupgrade
84+
]
85+
86+
[tool.ruff.lint.per-file-ignores]
87+
"tests/**.py" = ["D"]
88+
89+
[tool.ruff.lint.isort]
90+
force-single-line = true
91+
92+
[tool.ruff.lint.mccabe]
93+
max-complexity = 10
94+
95+
[tool.ruff.lint.pydocstyle]
96+
convention = "numpy"
7697

7798
[tool.mypy]
7899
check_untyped_defs = true

setup.cfg

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)