-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.ruff.desired.toml
148 lines (135 loc) · 7.05 KB
/
.ruff.desired.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
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
fix = false # Will not fix the code by default, only lint it.
indent-width = 4
line-length = 100
output-format = "concise"
required-version = ">=0.6.5"
show-fixes = false
# NOTE: Set it to the Python version you are using in the project.
target-version = "py310"
[format]
docstring-code-format = true
quote-style = "double"
[lint]
select = [
"F", # https://docs.astral.sh/ruff/rules/#pyflakes-f
"E", # https://docs.astral.sh/ruff/rules/#error-e
"W", # https://docs.astral.sh/ruff/rules/#warning-w
"C90", # https://docs.astral.sh/ruff/rules/#mccabe-c90
"I", # https://docs.astral.sh/ruff/rules/#isort-i
"N", # https://docs.astral.sh/ruff/rules/#pep8-naming-n
# "D", # https://docs.astral.sh/ruff/rules/#pydocstyle-d
"UP", # https://docs.astral.sh/ruff/rules/#pyupgrade-up
"YTT", # https://docs.astral.sh/ruff/rules/#flake8-2020-ytt
"ANN", # https://docs.astral.sh/ruff/rules/#flake8-annotations-ann
"ASYNC", # https://docs.astral.sh/ruff/rules/#flake8-annotations-ann
"S", # https://docs.astral.sh/ruff/rules/#flake8-bandit-s
"BLE", # https://docs.astral.sh/ruff/rules/#flake8-blind-except-ble
"FBT", # https://docs.astral.sh/ruff/rules/#flake8-boolean-trap-fbt
"B", # https://docs.astral.sh/ruff/rules/#flake8-bugbear-b
"A", # https://docs.astral.sh/ruff/rules/#flake8-builtins-a
"COM", # https://docs.astral.sh/ruff/rules/#flake8-commas-com
# "CPY", # https://docs.astral.sh/ruff/rules/#flake8-copyright-cpy # NOTE: it's not useful 99%, staying here to keep the list consistent.
"C4", # https://docs.astral.sh/ruff/rules/#flake8-comprehensions-c4
"DTZ", # https://docs.astral.sh/ruff/rules/#flake8-datetimez-dtz
"T10", # https://docs.astral.sh/ruff/rules/#flake8-debugger-t10
"DJ", # https://docs.astral.sh/ruff/rules/#flake8-django-dj
# "EM", # https://docs.astral.sh/ruff/rules/#flake8-errmsg-em
"EXE", # https://docs.astral.sh/ruff/rules/#flake8-executable-exe
"FA", # https://docs.astral.sh/ruff/rules/#flake8-future-annotations-fa
"ISC", # https://docs.astral.sh/ruff/rules/#flake8-implicit-str-concat-isc
"ICN", # https://docs.astral.sh/ruff/rules/#flake8-import-conventions-icn
"LOG", # https://docs.astral.sh/ruff/rules/#flake8-logging-log
"G", # https://docs.astral.sh/ruff/rules/#flake8-logging-format-g
# "INP", # https://docs.astral.sh/ruff/rules/#flake8-no-pep420-inp
"PIE", # https://docs.astral.sh/ruff/rules/#flake8-pie-pie
"T20", # https://docs.astral.sh/ruff/rules/#flake8-print-t20
"PYI", # https://docs.astral.sh/ruff/rules/#flake8-pyi-pyi
"PT", # https://docs.astral.sh/ruff/rules/#flake8-pytest-style-pt
# "Q", # https://docs.astral.sh/ruff/rules/#flake8-quotes-q
"RSE", # https://docs.astral.sh/ruff/rules/#flake8-raise-rse
"RET", # https://docs.astral.sh/ruff/rules/#flake8-return-ret
"SLF", # https://docs.astral.sh/ruff/rules/#flake8-self-slf
# "SLOT", # https://docs.astral.sh/ruff/rules/#flake8-slots-slot
"SIM", # https://docs.astral.sh/ruff/rules/#flake8-simplify-sim
"TID", # https://docs.astral.sh/ruff/rules/relative-imports/
"TCH", # https://docs.astral.sh/ruff/rules/#flake8-type-checking-tch
"INT", # https://docs.astral.sh/ruff/rules/#flake8-gettext-int
"ARG", # https://docs.astral.sh/ruff/rules/#flake8-unused-arguments-arg
"PTH", # https://docs.astral.sh/ruff/rules/#flake8-use-pathlib-pth
# "TD", # https://docs.astral.sh/ruff/rules/#flake8-todos-td
# "FIX", # https://docs.astral.sh/ruff/rules/#flake8-fixme-fix
# "ERA", # https://docs.astral.sh/ruff/rules/#eradicate-era
"PD", # https://docs.astral.sh/ruff/rules/#pandas-vet-pd
# "PGH", # https://docs.astral.sh/ruff/rules/#pandas-vet-pd
"PLC", # https://docs.astral.sh/ruff/rules/#convention-c
"PLE", # https://docs.astral.sh/ruff/rules/#error-e_1
# "PLR", # https://docs.astral.sh/ruff/rules/#refactor-r
# "PLW", # https://docs.astral.sh/ruff/rules/#warning-w_1
"TRY", # https://docs.astral.sh/ruff/rules/#tryceratops-try
"FLY", # https://docs.astral.sh/ruff/rules/#flynt-fly
# "NPY", # https://docs.astral.sh/ruff/rules/#numpy-specific-rules-npy
# "AIR", # https://docs.astral.sh/ruff/rules/#airflow-air
"PERF", # https://docs.astral.sh/ruff/rules/#perflint-perf
# "FURB", # https://docs.astral.sh/ruff/rules/#refurb-furb
"RUF", # https://docs.astral.sh/ruff/rules/#ruff-specific-rules-ruf
]
extend-select = [
"D", # https://docs.astral.sh/ruff/rules/#pydocstyle-d
"EM", # https://docs.astral.sh/ruff/rules/#flake8-errmsg-em
"INP", # https://docs.astral.sh/ruff/rules/#flake8-no-pep420-inp
"Q", # https://docs.astral.sh/ruff/rules/#flake8-quotes-q
"SLOT", # https://docs.astral.sh/ruff/rules/#flake8-slots-slot
"TD", # https://docs.astral.sh/ruff/rules/#flake8-todos-td
"FIX", # https://docs.astral.sh/ruff/rules/#flake8-fixme-fix
"ERA", # https://docs.astral.sh/ruff/rules/#eradicate-era
"PGH", # https://docs.astral.sh/ruff/rules/#pandas-vet-pd
"PLR", # https://docs.astral.sh/ruff/rules/#refactor-r
"PLW", # https://docs.astral.sh/ruff/rules/#warning-w_1
"NPY", # https://docs.astral.sh/ruff/rules/#numpy-specific-rules-npy;
"AIR", # https://docs.astral.sh/ruff/rules/#airflow-air
# "FURB", # https://docs.astral.sh/ruff/rules/#refurb-furb # NOTE: it's in preview.
]
ignore = [
"D100", # https://docs.astral.sh/ruff/rules/undocumented-public-module/
"D104", # https://docs.astral.sh/ruff/rules/undocumented-public-package/
"COM812", # https://docs.astral.sh/ruff/rules/missing-trailing-comma/ # NOTE: disabled because formatter is handling that
"ANN101", # https://docs.astral.sh/ruff/rules/missing-type-self/
"TD003", # https://docs.astral.sh/ruff/rules/missing-todo-link/
]
fixable = ["ALL"]
unfixable = ["ISC001"]
task-tags = ["TODO", "FIXME", "XXX", "NOTE"]
[lint.per-file-ignores]
"tests/**/*.py" = ["ANN", "D", "INP", "S101", "SLF", "PLR2004"]
[lint.flake8-annotations]
# ignore-fully-untyped = true # NOTE: Can be useful for projects that are not fully typed yet.
[lint.flake8-bugbear]
extend-immutable-calls = ["fastapi.Depends", "fastapi.Query"]
[lint.flake8-type-checking]
runtime-evaluated-base-classes = [
"pydantic.BaseModel",
"sqlalchemy.orm.DeclarativeBase",
]
runtime-evaluated-decorators = ["pydantic.validate_call", "attrs.define"]
[lint.isort]
detect-same-package = true
force-single-line = true # NOTE: Simplifies git diff appearance.
known-first-party = ["src", "pytest_samples"]
# required-imports = ["from __future__ import annotations"] # NOTE: For python < 3.10
[lint.mccabe]
max-complexity = 10
[lint.pep8-naming]
classmethod-decorators = [
# NOTE: Allow Pydantic's `@validator` decorator to trigger class method treatment.
"pydantic.validator",
"classmethod",
# NOTE: Allow SQLAlchemy's dynamic decorators, like `@field.expression`, to trigger class method treatment.
"declared_attr",
"expression",
"comparator",
]
[lint.pydocstyle]
convention = "google"
ignore-decorators = ["typing.overload"]
[lint.pylint]
allow-dunder-method-names = ["__tablename__", "__table_args__"]