@@ -75,32 +75,95 @@ line-ending = "lf"
7575
7676[tool .ruff .lint ]
7777select = [
78- " F" , # Pyflakes
79- " W" , # pycodestyle warnings
78+ " F" , # pyflakes
8079 " E" , # pycodestyle errors
80+ " W" , # pycodestyle warnings
8181 " I" , # isort
82+ " N" , # PEP8-naming
8283 " UP" , # pyupgrade
84+ " YTT" , # flake8-2020
8385 " ASYNC" , # flake8-async
86+ # "S", # flake8-bandit
87+ " BLE" , # flake8-blind-except
88+ # "FBT", # flake8-boolean-trap
8489 " B" , # flake8-bugbear
90+ " A" , # flake8-builtins
91+ " COM" , # flake8-commas
8592 " C4" , # flake8-comprehensions
8693 " DTZ" , # flake8-datetimez
8794 " T10" , # flake8-debugger
95+ # "FA", # flake8-future-annotations
96+ " ISC" , # flake8-implicit-str-concat
97+ " ICN" , # flake8-import-conventions
98+ " PIE" , # flake8-pie
8899 " T20" , # flake8-print
89100 " PYI" , # flake8-pyi
90- " PT" , # flake8-pytest-style
91101 " Q" , # flake8-quotes
102+ " RSE" , # flake8-raise
103+ " RET" , # flake8-return
104+ " SLOT" , # flake8-slots
92105 " SIM" , # flake8-simplify
93106 " TID" , # flake8-tidy-imports
94- " PLE" , # Pylint errors
95- " NPY" , # NumPy-specific rules
107+ # "TC", # flake8-type-checking
108+ # "ARG", # flake8-unused-arguments
109+ " PTH" , # flake8-use-pathlib
110+ # "ERA", # eradicate
111+ " PD" , # pandas-vet
112+ " PGH" , # pygrep-hooks
113+ " PL" , # pylint
114+ " TRY" , # tryceratops
115+ " FLY" , # flynt
116+ " FAST" , # FastAPI
117+ " PERF" , # Perflint
118+ " FURB" , # refurb
96119 " RUF" , # Ruff-specific rules
97120]
98121ignore = [
99- " E402" , # module-import-not-at-top-of-file
100- " RUF001" , # ambiguous-unicode-character-string
101- " RUF002" , # ambiguous-unicode-character-docstring
102- " RUF003" , # ambiguous-unicode-character-comment
122+ " C901" ,
123+ " T201" ,
124+ " E731" ,
125+ " PT023" ,
126+ " B010" , # Do not call `setattr` with a constant attribute value.
127+ " SIM105" , # Use `contextlib.suppress`
128+ " B008" , # Do not perform function call in argument defaults
129+ " RUF100" , # Unused `noqa` directive
130+ " TC003" , # Move xxx into a type-checking block
131+ " E402" , # module level import not at top of file
132+ " E501" , # 过长的行由 ruff format 处理, 剩余的都是字符串
133+ " UP035" , # pyupgrade, 但 typing.Callable 的导入会报错
134+ " TRY003" ,
135+ " TRY301" , # 为啥非要把 raise 丢进另外一个 inner fn 里
136+ " BLE001" , # except Exception as e
137+ " PGH003" , # 要求 `# type: ignore` 提供理由,但 pyright 和 mypy 等都不是统一标准。
138+ " PLC0414" , # 用 import-as 表示 re-export
139+ " N818" , # 要求所有自定义错误以 Error 作后缀,但我们不这么做
140+ " RET502" , # return = return None
141+ " RET503" , # 就要 implicit return none
142+ " PLC0105" , # 我们已经用 R 表示协变,Q 表示逆变了
143+ " PLR0913" , # 参数就那么多的,你用 builder 什么的不是更逆天?
144+ " SIM108" , # 迫真 simplicy
145+ " RUF001" , # String contains ambiguous `,` (FULLWIDTH COMMA). Did you mean `,` (COMMA)?
146+ " RUF002" , # Docstring contains ambiguous `,` (FULLWIDTH COMMA). Did you mean `,` (COMMA)?
147+ " RUF009" , # 我不想要额外的全局变量。
148+ " UP038" , # instance(..., X | Y) 还是太超前了
149+ " RUF003" , # 中文注释里用全角符号怎么你了
150+ " SLOT000" , # 动态类型需求,主要是 json5 backend
151+ " PLR0911" , " PLR0912" , " PLR0915" , # 复杂度高点怎么你了
152+ " PYI041" , # int 和 float 在运行时的类型没有交集(互不成立 issubclass)
153+ " PLW2901" , # shallow 怎么你了
154+ " S101" , # assert 怎么你了,非要 RuntimeError 吗
155+ " PLR2004" , # magic number 怎么你了
156+ " TRY004" , # 我要抛啥错误我清楚
157+ " COM812" , # 强制尾随逗号
158+ " TID252" , # 相对导入
159+ " ISC001" , # format warning
160+ " N801" , # Class name should use CapWords convention
161+ " N802" , # Function name should be lowercase
162+ " N804" , # First argument of a class method should be named `cls`
163+ " N805" , # First argument of a method should be named `self`
164+ " N806" , # Variable in function should be lowercase
103165]
166+ flake8-quotes = { inline-quotes = " double" , multiline-quotes = " double" }
104167
105168[tool .ruff .lint .isort ]
106169force-sort-within-sections = true
0 commit comments