|
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 | | - |
17 | 1 | [tool.pytest.ini_options] |
| 2 | +python_files = "tests.py test_*.py" |
18 | 3 | # Disable warnings from third-party libraries |
19 | 4 | filterwarnings = "ignore::DeprecationWarning" |
20 | 5 |
|
21 | | - |
22 | 6 | [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"] |
23 | 10 | lint.extend-ignore = [ |
| 11 | + "ARG002", # Unused method args like args and kwargs are ok |
24 | 12 | "DTZ003", |
25 | 13 | "DTZ007", |
26 | 14 | "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 |
27 | 17 | "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 |
29 | 21 | "PLR0913", # don't complain about too many arguments |
| 22 | + "PLR0915", # Don't complain about too many statements in a method |
30 | 23 | "PLR2004", # Don't force every magic value to be a constant |
31 | 24 | "PLW0120", # else without a break is fine (I use return with for-else) |
32 | 25 | "RET505", # Allow for return values to be set outside of if/else blocks |
33 | 26 | "RET506", # Allow for return values to be set after raising an exception |
34 | 27 | "RET507", # Allow for return values to be set after continue |
35 | 28 | "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 |
36 | 36 | "S101", # assert |
37 | 37 | "S105", # possible hardcoded password |
| 38 | + "S106", # possible hardcoded password |
38 | 39 | "S308", # Trust us with mark_safe |
39 | 40 | "S311", # Trust us with random |
40 | 41 | "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 |
43 | 44 | "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 |
44 | 48 | "TRY003", # long messages in exceptions are ok |
45 | 49 | ] |
46 | 50 | # 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 |
48 | 51 | 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 |
83 | 87 | ] |
84 | | -target-version = "py312" |
| 88 | +target-version = "py313" |
| 89 | +format.docstring-code-format = true |
| 90 | + |
85 | 91 | # 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) |
91 | 93 | lint.unfixable = ["F401", "F841"] |
92 | 94 |
|
93 | 95 | [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 | + |
96 | 109 |
|
97 | 110 | [tool.semantic_release] |
98 | 111 | version_variable = "aicodebot:version" |
0 commit comments