-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path.ruff.toml
More file actions
121 lines (109 loc) · 6.53 KB
/
.ruff.toml
File metadata and controls
121 lines (109 loc) · 6.53 KB
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
line-length = 100
target-version = "py312"
src = ["agentune", "tests"]
[lint]
select = [
"YTT", # flake8-2020 (mishandling sys.version)
"ANN",
"ASYNC",
"FAST", # FastAPI
"S", # flake8-bandit (misc ruleset)
"BLE", # Don't catch all exceptions
"B", # flake8-bugbear (misc ruleset)
"C4", # flake8-comprehensions
"T10", # flake8-debugger
"EXE", # flake8-executable
"FA", # flake8-future-annotations
"ISC", # flake8-implicit-str-concat
"ICN", # flake8-import-conventions
"LOG", # flake8-logging
"INP", # flake8-no-pep420
"PIE", # flake8-pie (misc)
"T20", # flake8-print
"PYI", # flake8-pyi (reated to type hints)
"PT", # flake8-pytest-style
"Q", # flake8-quotes
"RSE", # flake8-raise
"SIM101", "SIM102", "SIM105", "SIM107", "SIM113", "SIM115", "SIM118", "SIM220", "SIM221", "SIM222", "SIM223", "SIM401", "SIM905", "SIM910", "SIM911",
"SLOT", # flake8-slots
"TID", # flake8-tidy-imports
"ARG", # flake8-unused-arguments
"PTH", # flake8-use-pathlib
"I", # isort (sort imports)
"NPY", # numpy
"N", # PEP8 naming
"E", "W", # pycodestyle
"D", # pydocstyle
"F", # pyflakes
"PGH", # pygrep-hooks
"PL", # pylint
"UP", # pyupgrade
"FURB", # refurb
"RUF", # Ruff-original rules
"TRY", # Tryceratops
"S101"
]
# We may later want to enable:
# flake8-logging-format (G)
# pydoclint (DOC)
ignore = [
"E203", "E266", "E501", # Relax whitespace & long-line rules
"E701", # Two statements on one line, e.g. `case foo: return bar`
"W293", # Blank line contains whitespace
"W291", # Trailing whitespace
"TC001", "TC002", "TC003", # Move imports used only for type hints into type-checking block
"TC006", # Use quoted type in cast
"D100", "D101", "D102", "D103", "D104", "D105", "D107", # Missing docstring in public xxx
"D210", # No whitespaces allowed surrounding docstring text
"D203", "D204", "D205", # Blank lines required before/after docstrings
"D213", # Non-standard, opposite of D212
"D400", # First line should end with a period
"D401", # First line of docstring should be in imperative mood
"D404", # First word of docstring should not be 'this'
"D413", # Require blank line after each section in docstring
"D415", # First line should end with a period, question mark, or exclamation point
"D417", # Some but not all Args documented in docstring
"RUF009", # Do not perform function call in dataclass defaults,
"RUF021", # Parenthesize and/or subexpressions
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed,
"PYI034", # `__iter__` methods... usually return `self` at runtime
"B024", # ABC has no abstract methods (because it's empty)
"TRY003", # Avoid specifying long messages outside the exception class
"TRY004", # Prefer TypeError for invalid type - good in theory but the implementation seems to be "do not mention the word type on the same line as any ValueError"
"TRY300", # No return inside try
"A002", # `input` is shadowing a Python builtin
"DTZ005", # `datetime.datetime.now()` called without a `tz` argument - it's fine to use naive dates and assume UTC
"C901", "PLR0904", "PLR0911", "PLR0912", "PLR0913", "PLR0914", "PLR0915", # Too complex, too many branches, etc
"PIE808", # Unnecessary `start` argument in `range`
"S311", # Use of `random` module
"RUF002", # "Ambiguous" Unicode characters (like the scary lowercase sigma, σ)
"B008", # No function calls in the definition of a function's default argument
"UP037", # Don't use string type annotations - they can be necessary when avoiding a circular import
"PT018", # assert x and y
"PT012", # pytest.assert block should contain a single simple statement (oh noes! we have two!)
"PLC0415", # allow local/conditional imports
"ASYNC109", # async function has a parameter named 'timeout'
# Rules we may want to enforce in the future but are ignored for now
"S608", # Possible SQL injection
"RET505", # Unnecessary else after return statement
]
[lint.flake8-quotes]
inline-quotes = "single"
multiline-quotes = "single"
[lint.flake8-annotations]
mypy-init-return = true # Allow __init__ methods not to declare -> None
[lint.isort]
known-first-party = ["agentune"]
[format]
quote-style = "single"
indent-style = "space"
line-ending = "lf"
[lint.per-file-ignores]
"tests/**" = [
"PLR2004", # Magic value constant
"T201", # Use of print
"S101", # Use of assert
]
"*.ipynb" = [
"T201" # Use of print
]