-
Notifications
You must be signed in to change notification settings - Fork 168
/
pyproject.toml
198 lines (189 loc) · 5.54 KB
/
pyproject.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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
[tool.black]
line-length = 120
[tool.isort]
profile = "black"
line_length = 120
[tool.pylint.BASIC]
good-names = [
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
"n",
"p",
"q",
"r",
"s",
"t",
"u",
"v",
"w",
"ex",
"Run",
"_",
"x",
"y",
"z"
]
[tool.pylint.main]
# https://github.com/pylint-dev/pylint/issues/3242#issuecomment-776482259
# Please don't use ** for the pattern. It will cause pylint to crash.
# the crash error message would like:
# re.error: multiple repeat at position 41
ignore-paths = [".*/examples/directml/llm/chat_app/.*"]
[tool.pylint.messages_control]
disable = [
# TODO:(myguo): consider remove them in the blacklist
"broad-exception-caught",
"c-extension-no-member",
"cyclic-import", # Disable cyclic-import because it is pylint bug
"consider-using-f-string",
"consider-using-from-import",
"format",
"expression-not-assigned",
"line-too-long",
"import-error",
"import-outside-toplevel",
"invalid-name",
"no-else-continue",
"no-else-raise",
"no-else-return",
"no-name-in-module",
"no-member",
"no-self-argument",
"too-few-public-methods",
"too-many-arguments",
"too-many-branches",
"too-many-function-args",
"too-many-instance-attributes",
"too-many-locals",
"too-many-nested-blocks",
"too-many-public-methods",
"too-many-return-statements",
"too-many-statements",
"missing-docstring",
"fixme",
"unspecified-encoding",
"unused-argument"
]
[tool.ruff]
line-length = 120
target-version = "py38"
[tool.ruff.lint]
select = [
"A", # flake8-builtins
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"CPY", # flake8-copyright
"D", # flake8-docstrings,
"E", # pycodestyle
"F", # Pyflakes
"FLY", # flake8-flynt
"G", # flake8-logging-format
"ICN", # flake8-import-conventions
"INP", # flake8-no-pep420
"INT", # flake8-gettext
"ISC", # flake8-implicit-str-concat
"LOG", # flake8-logging
"N", # pep8-naming
"NPY", # numpy
"PD", # flake8-pandas
"PERF", # Perflint
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"PLC", # pylint conventions
"PLE", # pylint errors
"PLW", # pylint warnings
"PT", # flake8-pytest
"PTH", # flake8-use-pathlib
"PYI", # flake8-pyi
"Q", # flake8-quotes
"RET", # flake8-return
"RSE", # flake8-raise
"RUF", # Ruff-specific rules
"SIM", # flake8-simplify
"T10", # flake8-debugger
"T20", # flake8-print
"TCH", # flake8-type-checking
"TD", # flake8-todo
"TID", # flake8-tidy-imports
"TRY", # tryceratops
"UP", # pyupgrade
"W", # pycodestyle
"YTT" # flake8-2020,
]
# NOTE: Refrain from growing the ignore list unless for exceptional cases.
# Always include a comment to explain why.
ignore = [
"B028", # FIXME: Add stacklevel to warnings
"B905", # keep using less than Python 3.10. The strict is added in Python 3.10
"D100", # Ignore missing docstring in public module
"D101", # Ignore missing docstring in public class
"D102", # Ignore missing docstring in public method
"D103", # Ignore missing docstring in public function
"D104", # Ignore missing docstring in public package
"D105", # Ignore missing docstring in magic method
"D106", # Ignore missing docstring in public nested class
"D107", # Ignore missing docstring in __init__
"D406", # Ignore new line after section name
"D407", # Ignore dashed-underline-after-section
"N803", # Argument casing
"N812", # Allow import torch.nn.functional as F
"N999", # Module names
"NPY002", # np.random.Generator may not always fit our use cases
"PERF203", # "try-except-in-loop" only affects Python <3.11, and the improvement is minor; can have false positives
"PLW0603", # TODO: temp disable global variable check
"PT004", # Ignore pytest fixture name
"PT019", # Ignore pytest fixture name
"PTH100", # We still support os.path.abspath
"PTH103", # We still support os.makedirs
"PTH106", # We still support os.rmdir
"PTH107", # We still support os.remove
"PTH110", # We still support os.path.exists
"PTH118", # We still need support os.path.join
"PTH119", # We still need support os.path.basename
"PTH120", # We still need support os.path.dirname
"PTH123", # we still need built-in open
"RET505", # We prefer if/else clauses explicitly
"RET506", # We prefer if/else clauses explicitly
"RET507", # We prefer if/else clauses explicitly
"RUF010", # keeping using str type explicitly
"RUF013", # Ignore Optional type hints warning since it is available in Python 3.10
"SIM105", # We don't prefer use context.suppress
"SIM108", # We don't encourage ternary operators
"TD003", # Ignore TODO links
"TRY002", # Ignore create custom exception
"TRY003", # Ignore check message not defined in the exception class
"TRY004", # Ignore prefer TypeError over ValueError
"TRY300", # Ignore check if return in try block
"UP032", # Ignore string format calls
"UP038" # Ignore old isinstance hints
]
ignore-init-module-imports = true
unfixable = [
"F401", # Unused imports
"SIM112" # Use upper case for env vars
]
[tool.ruff.lint.flake8-tidy-imports]
# Disallow all relative imports.
ban-relative-imports = "all"
[tool.ruff.lint.pep8-naming]
# Allow Pydantic's `@validator` decorator to trigger class method treatment.
classmethod-decorators = ["classmethod", "olive.common.pydantic_v1.validator", "olive.common.pydantic_v1.root_validator"]
[tool.ruff.lint.per-file-ignores]
".azure_pipelines/**" = ["INP001"]
"examples/**" = ["TID252", "INP001"]
"docs/**" = ["INP001"]
"test/**" = ["INP001"]
"scripts/**" = ["INP001"]
"examples/directml/llm/chat_app/**" = ["TID252", "UP006", "T201"]
"olive/cli/**" = ["T201"]