-
Notifications
You must be signed in to change notification settings - Fork 0
/
ruff.toml
94 lines (79 loc) · 3.41 KB
/
ruff.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# This is a configuration file for the Ruff formatter and linter
#
# If not using ruff, this file can be deleted
# If using ruff, it is best practice to move the contents of this file to pyproject.toml
# When moving the contents to pyproject.toml:
# - Move top level keys to the [tool.ruff] section
# - Prefix all other sections with "tool.ruff." (e.g. [format] -> [tool.ruff.format])
# Note that this configuration has ruff in a reasonably strict configuration.
# While it doesn't get in the way much when working in an already clean codebase,
# it can be painful to convert new code to this standard.
# It is easier to start adding rules as one by one, rather than starting with all rules enabled.
# This can be done by changing the `select` key in the [lint] section to a list of rules to enable.
exclude = [
"setup.py",
"**/migrations/**", # Django
"manage.py", # Django
"celeryconfig.py", # Celery
"gunicorn.conf.py", # Gunicorn
]
[format]
exclude = [
"**/migrations/**",
"setup.py",
"manage.py"
]
[lint]
select = ["ALL"] # Enable all rules
ignore = [
# Against q-ctrl convention
"D100", # missing-module-docstring
"DJ008", # Model does not define `__str__` method
"FIX", # Line contains TODO
"PLR0912", # pylint's too-many-branches
"PLR0913", # pylint's too-many-arguments
"PLR0914", # pylint's too-many-locals
"PLR0915", # pylint's too-many-statements
"PT004", # Fixture does not return anything, add leading underscore
"TD", # Invalid TODO tag
# Overly prescriptive
"ANN101", # Missing type annotation for self in method
"ANN102", # Missing type annotation for cls in classmethod
"ANN401", # Use of Any type
"CPY", # Missing copyright notice at top of file
"D104", # Missing docstring in public package
"D105", # Missing docstring in magic method
"D205", # 1 blank line required between summary line and description
"D400", # First line should end with a period
"D401", # First line of docstring should be in imperative mood
"EM", # Exception must not use a string literal
"FA102", # Require from __future__ import annotations for compatibility with python < 3.9
"FBT", # Boolean-typed positional arguments
"SIM108", # Use ternary operator instead of `if`-`else`-block
"TRY003", # Avoid specifying long messages outside the exception class
# conflict with other rules
"D203", # 1 blank line required before class docstring
"D212", # Multi-line docstring summary should start at the first line
# conflict with formatter
"COM812", # Trailing comma missing
"E501", # Line too long
"ISC001", # Implicitly concatenated string literals on one line
# conflict with pydantic
"RUF012", # Mutable class attributes should be annotated with typing.ClassVar
]
extend-select = [
"D213", # Multi-line docstring summary should start at the second line
]
[lint.per-file-ignores]
"{test_,conftest,*pytest_plugin}*" = [ # pytest files
"ARG001", # unused arg (pytest fixtures)
"ANN", # missing type annotation (pytest fixtures)
"D", # docstrings (unnecessary in tests)
"PLR2004", # magic values (often used in tests)
"S", # security (not relevant in tests)
"SLF001", # private member access (often used in tests)
]
[lint.flake8-unused-arguments]
ignore-variadic-names = true # Allow unused *args and **kwargs
[lint.pydocstyle]
convention = "numpy" # Use numpy docstring style