Skip to content

Commit 088f32f

Browse files
author
Nick Sullivan
committed
🔧 Consolidate code formatting tools into Ruff configuration
Removes separate Black and isort configurations in favor of Ruff's built-in formatting and import sorting. Standardizes line length to 88 chars and adds per-file linting rules for tests. Simplifies toolchain while maintaining code quality standards.
1 parent 8036135 commit 088f32f

File tree

1 file changed

+16
-20
lines changed

1 file changed

+16
-20
lines changed

pyproject.toml

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,3 @@
1-
[tool.black]
2-
line-length = 120
3-
target-version = ["py313"]
4-
5-
[tool.isort]
6-
line_length = 115
7-
profile = "black"
8-
py_version = 312 # isort doesn't support 3.13 yet
9-
use_parentheses = true
10-
## Ignore the source of the import and just sort alphabetically, with "from" before "import"
11-
combine_as_imports = true
12-
combine_straight_imports = true
13-
from_first = true
14-
lines_between_sections = 0
15-
no_sections = true
16-
17-
181
[tool.pytest.ini_options]
192
python_files = "tests.py test_*.py"
203
# Disable warnings from third-party libraries
@@ -23,6 +6,7 @@ filterwarnings = "ignore::DeprecationWarning"
236
# DJANGO_SETTINGS_MODULE = django_project.settings
247

258
[tool.ruff]
9+
exclude = ["**/migrations", "**/node_modules"]
2610
lint.extend-ignore = [
2711
"DTZ003",
2812
"DTZ007",
@@ -46,9 +30,8 @@ lint.extend-ignore = [
4630
"TRY003", # long messages in exceptions are ok
4731
]
4832
# https://beta.ruff.rs/docs/rules/#ruff-specific-rules-ruf
49-
line-length = 120
33+
line-length = 88
5034
lint.select = [
51-
# Note, don't use isort through ruff, it's not as configurable as the standalone tool
5235
"A", # builtins
5336
#"ARG", # unused arguments
5437
"B", # bugbear
@@ -72,7 +55,7 @@ lint.select = [
7255
"PTH", # Use path library
7356
"RET", # return statements
7457
"RSE", # raise statements
75-
#"RUF", # ruff Disabled because it is too aggressive about removing noqa settings when editing files
58+
#"RUF", # ruff
7659
"S", # flake8-bandit
7760
"SIM", # flake8 simplify
7861
"SLF", # self
@@ -87,3 +70,16 @@ target-version = "py313"
8770
# Certain errors we don't want to fix because they are too aggressive,
8871
# especially in the editor (removing variables we haven't used yet)
8972
lint.unfixable = ["F401", "F841"]
73+
74+
# Ruff import-sorting configuration (replaces standalone isort)
75+
lint.isort.combine-as-imports = true
76+
lint.isort.force-wrap-aliases = true
77+
lint.isort.from-first = true
78+
lint.isort.lines-between-types = 0
79+
80+
[tool.ruff.format]
81+
docstring-code-format = true
82+
83+
[tool.ruff.lint.per-file-ignores]
84+
"test_*.py" = ["PLR0915", "ARG001", "ARG005", "SLF001", "F841"]
85+
"**/conftest.py" = ["ARG001"]

0 commit comments

Comments
 (0)