Skip to content

Commit 3b0511e

Browse files
committed
Use of Ruff
1 parent 90aef38 commit 3b0511e

File tree

4 files changed

+29
-53
lines changed

4 files changed

+29
-53
lines changed

.flake8

-7
This file was deleted.

.pre-commit-config.yaml

+7-34
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
11
repos:
2-
# Modifiers
3-
- repo: https://github.com/psf/black
4-
rev: 24.10.0
5-
hooks:
6-
- id: black
7-
8-
- repo: https://github.com/pre-commit/mirrors-prettier
9-
rev: v4.0.0-alpha.8
10-
hooks:
11-
- id: prettier
12-
132
- repo: https://github.com/pre-commit/pre-commit-hooks
143
rev: v5.0.0
154
hooks:
@@ -21,27 +10,11 @@ repos:
2110
- id: check-yaml
2211
- id: end-of-file-fixer
2312

24-
- repo: https://github.com/asottile/pyupgrade
25-
rev: v3.19.1
26-
hooks:
27-
- id: pyupgrade
28-
args: [--py39-plus]
29-
30-
- repo: https://github.com/pycqa/isort
31-
rev: 5.13.2
32-
hooks:
33-
- id: isort
34-
args: ["--filter-files"]
35-
36-
- repo: https://github.com/pycqa/flake8
37-
rev: 7.1.1
38-
hooks:
39-
- id: flake8
40-
41-
# Static Checkers
42-
- repo: https://github.com/PyCQA/bandit
43-
rev: 1.7.10
13+
- repo: https://github.com/astral-sh/ruff-pre-commit
14+
# Ruff version.
15+
rev: v0.9.1
4416
hooks:
45-
- id: bandit
46-
additional_dependencies: [".[toml]"]
47-
args: ["-c", "bandit.yml"]
17+
# Run the linter.
18+
- id: ruff
19+
# Run the formatter.
20+
- id: ruff-format

bandit.yml

-2
This file was deleted.

pyproject.toml

+22-10
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,11 @@ python = ["3.9", "3.10", "3.11", "3.12"]
6161

6262
[tool.hatch.envs.pre-commit]
6363
dependencies = [
64-
"bandit",
65-
"black",
66-
"flake8",
67-
"flake8-bugbear == 22.*",
68-
"flake8-docstrings",
69-
"isort",
70-
"pep8-naming",
64+
"ruff",
7165
"pre-commit",
7266
"pre-commit-hooks",
73-
"pyupgrade",
7467
]
68+
7569
[tool.hatch.envs.pre-commit.scripts]
7670
run = [
7771
"pre-commit run --all-files --show-diff-on-failure",
@@ -92,6 +86,7 @@ dependencies = [
9286
"pytest",
9387
"freezegun",
9488
]
89+
9590
[tool.hatch.envs.mypy.scripts]
9691
run = [
9792
"mypy src/ tests/ docs/conf.py",
@@ -105,6 +100,7 @@ dependencies = [
105100
"pygments",
106101
"freezegun",
107102
]
103+
108104
[tool.hatch.envs.tests.scripts]
109105
run = [
110106
"coverage run --parallel -m pytest"
@@ -114,11 +110,13 @@ run = [
114110
dependencies = [
115111
"coverage[toml]",
116112
]
113+
117114
[tool.hatch.envs.coverage.scripts]
118115
run = [
119116
"- coverage combine",
120117
"coverage report",
121118
]
119+
122120
run-xml = [
123121
"coverage xml"
124122
]
@@ -131,6 +129,7 @@ dependencies = [
131129
"typeguard",
132130
"pygments",
133131
]
132+
134133
[tool.hatch.envs.typeguard.scripts]
135134
run = [
136135
"pytest --typeguard-packages=human_readable",
@@ -140,6 +139,7 @@ run = [
140139
dependencies = [
141140
"xdoctest[colors]",
142141
]
142+
143143
[tool.hatch.envs.xdoctest.scripts]
144144
run = [
145145
"python -m xdoctest human_readable all",
@@ -151,6 +151,7 @@ dependencies = [
151151
"furo",
152152
"myst-parser",
153153
]
154+
154155
[tool.hatch.envs.docs-build.scripts]
155156
run = [
156157
"rm -rf docs/_build",
@@ -164,6 +165,7 @@ dependencies = [
164165
"furo",
165166
"myst-parser",
166167
]
168+
167169
[tool.hatch.envs.docs.scripts]
168170
run = [
169171
"rm -rf docs/_build",
@@ -182,7 +184,18 @@ source = ["human_readable", "tests"]
182184
show_missing = true
183185
fail_under = 100
184186

185-
[tool.isort]
187+
[tool.ruff]
188+
line-length = 80
189+
190+
[tool.ruff.lint]
191+
select = ["B", "B9", "C", "D", "E", "F", "N", "W"]
192+
ignore = ["E203", "E501", "W503", "B905"]
193+
per-file-ignores = [ "times.py:N806" ]
194+
195+
[tool.ruff.lint.mccabe]
196+
max-complexity = 10
197+
198+
[tool.ruff.lint.isort]
186199
profile = "black"
187200
force_single_line = true
188201
lines_after_imports = 2
@@ -195,7 +208,6 @@ show_column_numbers = true
195208
show_error_codes = true
196209
show_error_context = true
197210

198-
199211
[[tool.mypy.overrides]]
200212
module = ["pytest_mock"]
201213
ignore_missing_imports = true

0 commit comments

Comments
 (0)