Skip to content
This repository was archived by the owner on Mar 9, 2026. It is now read-only.

Commit f3401ef

Browse files
author
Nick Sullivan
committed
🔧 Refactor pyproject.toml for improved linting and testing
- Remove Black and isort configurations - Expand Ruff linter rules and ignore list - Update pytest configuration - Adjust line length to 120 characters - Add per-file ignores for tests and conftest.py This change streamlines our development tooling, focusing on Ruff for linting and formatting while enhancing test configurations. It should improve code quality and consistency across the project. 💅
1 parent db46daa commit f3401ef

1 file changed

Lines changed: 76 additions & 63 deletions

File tree

pyproject.toml

Lines changed: 76 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,111 @@
1-
[tool.black]
2-
line-length = 115
3-
target-version = ["py312"]
4-
5-
[tool.isort]
6-
line_length = 115
7-
profile = "black"
8-
py_version = 312
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-
171
[tool.pytest.ini_options]
2+
python_files = "tests.py test_*.py"
183
# Disable warnings from third-party libraries
194
filterwarnings = "ignore::DeprecationWarning"
205

21-
226
[tool.ruff]
7+
# Format to 120 characters, but don't complain about longer lines for things like log messages
8+
line-length = 120
9+
exclude = ["**/migrations", "**/node_modules", "tests/rebuild_patch_data"]
2310
lint.extend-ignore = [
11+
"ARG002", # Unused method args like args and kwargs are ok
2412
"DTZ003",
2513
"DTZ007",
2614
"E401", # multiple imports on one line
15+
"E501", # Line too long - format to 120 but don't complain about longer
16+
"FURB157", # Quotes in Decimal calls are ok
2717
"N817", # D for decimal
28-
"PLR0912", # Don't compplain about too many branches
18+
"PERF401", # Don't force list comprehensions
19+
"PLR0911", # Don't complain about too many return statements
20+
"PLR0912", # Don't complain about too many branches
2921
"PLR0913", # don't complain about too many arguments
22+
"PLR0915", # Don't complain about too many statements in a method
3023
"PLR2004", # Don't force every magic value to be a constant
3124
"PLW0120", # else without a break is fine (I use return with for-else)
3225
"RET505", # Allow for return values to be set outside of if/else blocks
3326
"RET506", # Allow for return values to be set after raising an exception
3427
"RET507", # Allow for return values to be set after continue
3528
"RET508", # Allow for return values to be set after break
29+
"RUF001", # Don't complain about ambiguous text in strings
30+
"RUF002", # Don't complain about × (multiplication sign) in docstrings
31+
"RUF003", # Don't complain about × (multiplication sign)
32+
"RUF012", # Don't force annotations of mutable class attributes
33+
"RUF013", # Optional args are ok
34+
"RUF010", # Don't force f-strings everywhere
35+
"RUF100", # Allow unused imports
3636
"S101", # assert
3737
"S105", # possible hardcoded password
38+
"S106", # possible hardcoded password
3839
"S308", # Trust us with mark_safe
3940
"S311", # Trust us with random
4041
"S324", # Trust us with hashlib
41-
"S603", # Trust us with subprocess
42-
"S607", # Trust us with subprocess with partial commands
42+
"S603", # subprocess call
43+
"SIM102", # Nested ifs are ok
4344
"SIM108", # Don't force ternary operators
45+
"SIM105", # try/except/pass is fine
46+
"TRY300", #
47+
"TRY301", # Let me raise errors how I want to
4448
"TRY003", # long messages in exceptions are ok
4549
]
4650
# https://beta.ruff.rs/docs/rules/#ruff-specific-rules-ruf
47-
line-length = 120 # Tell the linter the max length is 120, and the other tools aim for 115
4851
lint.select = [
49-
# Note, don't use isort through ruff, it's not as configurable as the standalone tool
50-
"A", # builtins
51-
#"ARG", # unused arguments
52-
"B", # bugbear
53-
"DJ", # django
54-
"DTZ", # datetimez
55-
"E", # pycodestyle
56-
"EXE", # executable settings
57-
"F", # pyflakes
58-
"INP", # implicit namespace packages
59-
"ISC", # string concatenation
60-
"N", # pep8 naming
61-
"NPY", # numpy
62-
"PD", # pandas checking
63-
"PGH", # explicit noqa
64-
"PIE", # flake8 pie
65-
"PLC", # pylint convention
66-
"PLE", # pylint errors
67-
"PLR", # pylint refactor
68-
"PLW", # pylint warnings
69-
#"PT", # pytest style
70-
"PTH", # Use path library
71-
"RET", # return statements
72-
"RSE", # raise statements
73-
#"RUF", # ruff Disabled because it is too aggressive about removing noqa settings when editing files
74-
"S", # flake8-bandit
75-
"SIM", # flake8 simplify
76-
"SLF", # self
77-
"T10", # debug statements
78-
"T20", # print statements
79-
"TRY", # try/except
80-
"UP", # pyupgrade
81-
"W", # pycodestyle warnings
82-
"YTT", # flake8 2020
52+
"A", # builtins
53+
"ARG", # unused arguments
54+
"B", # bugbear
55+
"DTZ", # datetimez
56+
"E", # pycodestyle
57+
"EXE", # executable settings
58+
"F", # pyflakes
59+
"FURB", # modernize codebase
60+
"I", # Isort
61+
"INP", # implicit namespace packages
62+
"ISC", # string concatenation
63+
"N", # pep8 naming
64+
"NPY", # numpy
65+
"PD", # pandas checking
66+
"PERF", # Perflint
67+
"PGH", # explicit noqa
68+
"PIE", # flake8 pie
69+
"PLC", # pylint convention
70+
"PLE", # pylint errors
71+
"PLR", # pylint refactor
72+
"PLW", # pylint warnings
73+
"PTH", # Use path library
74+
"RET", # return statements
75+
"RSE", # raise statements
76+
"RUF", # ruff
77+
"S", # flake8-bandit
78+
"SIM", # flake8 simplify
79+
"SLF", # self
80+
"SLOT",
81+
"T10", # debug statements
82+
"T20", # print statements
83+
"TRY", # try/except
84+
"UP", # pyupgrade
85+
"W", # pycodestyle warnings
86+
"YTT", # flake8 2020
8387
]
84-
target-version = "py312"
88+
target-version = "py313"
89+
format.docstring-code-format = true
90+
8591
# Certain errors we don't want to fix because they are too aggressive,
86-
# especially in the editor (removing variables we haven't used yet
87-
extend-exclude = [
88-
# Don't look at the patch data because it contains incomplete python files
89-
"tests/rebuild_patch_data",
90-
]
92+
# especially in the editor (removing variables we haven't used yet)
9193
lint.unfixable = ["F401", "F841"]
9294

9395
[tool.ruff.lint.per-file-ignores]
94-
# Allow print statements in tests
95-
"test_*.py" = ["T201"]
96+
"test_*.py" = [
97+
"PLR0915", # Pylint: Too many statements (tests can be long)
98+
"ARG001", # Ruff: Unused function argument (common with pytest fixtures)
99+
"ARG005", # Ruff: Unused argument in lambda expression
100+
"SLF001", # Ruff: Private member accessed (tests may need to inspect internals)
101+
"F841", # Ruff: Local variable assigned but never used (common in test setup)
102+
"T201", # Allow print statements in tests
103+
]
104+
"*/conftest.py" = [
105+
"ARG001", # Allow unused arguments in pytest hooks and fixtures
106+
]
107+
108+
96109

97110
[tool.semantic_release]
98111
version_variable = "aicodebot:version"

0 commit comments

Comments
 (0)