-
Notifications
You must be signed in to change notification settings - Fork 851
Expand file tree
/
Copy pathruff.toml
More file actions
93 lines (84 loc) · 2.94 KB
/
ruff.toml
File metadata and controls
93 lines (84 loc) · 2.94 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
target-version = "py39" # Target the oldest supported version
# This file is not UTF-8
extend-exclude = ["pythonwin/pywin/test/_dbgscript.py"]
[format]
line-ending = "cr-lf"
[lint]
select = [
"B028", # no-explicit-stacklevel
"C4", # flake8-comprehensions
"F401", # unused-import
"F811", # redefined-while-unused
"I", # isort
"PLC", # Pylint Convention
"PLE", # Pylint Error
"RSE", # flake8-raise
"W", # pycodestyle Warning
"YTT", # flake8-2020
# String formatting, concatenating, interpolation, ...
"FLY", # static-join-to-f-string
"G", # flake8-logging-format
# Ensure modern type annotation syntax and best practices
# Not including those covered by type-checkers or exclusive to Python 3.11+
"FA", # flake8-future-annotations
"F404", # late-future-import
"PYI", # flake8-pyi
# Code modernization (strings, annotations, conditions, ...)
"UP", # pyupgrade
# Helps prevent circular imports and other unneeded imports
"TC", # flake8-type-checking
]
extend-ignore = [
# Lots of lazy or side-effect imports
"PLC0415", # import-outside-top-level
# We prefer explicit open mode parameter
"UP015", # redundant-open-modes
# No such concerns for stdlib
"TC003", # typing-only-standard-library-import
# TODO: Consider passing exception around to ensure methods are only ever used within exception handlers
"PLE0704", # misplaced-bare-raise
# TODO: Still lots of manual fixes needed
"UP031", # Use format specifiers instead of percent format
"UP032", # Use f-string instead of format call
]
[lint.per-file-ignores]
# Explicit re-exports is fine in __init__.py, still a code smell elsewhere.
"__init__.py" = ["PLC0414"]
# TODO: Make adodbapi changes in their own PRs
"adodbapi/*" = [
"C4",
"UP031",
"UP032",
# Dropping Python 3.8 support
"UP005",
"UP006",
"UP018",
"UP035",
"UP036",
"YTT301",
]
[lint.pyflakes]
allowed-unused-imports = [
# Modules with known side-effects
"coloreditor", # Adds doc template
"IDLEenvironment", # Injects fast_readline into the IDLE auto-indent extension
"pythoncom", # pythoncomXX.dll loader
"pywintypes", # pywintypesXX.dll loader
"win32com", # Sets pythoncom.frozen and adds modules to path based on the registry
"win32traceutil", # Redirects output to win32trace remote collector
"win32ui", # Must always be imported before dde
# Note: com/win32com/client/gencache.py does read files on import, but only to fill in it's own dicts from cache
]
[lint.isort]
combine-as-imports = true
# Because pywin32 has a mix of relative and absolute imports, with undetectable first-party c-extensions
# This makes import grouping more consistent
detect-same-package = false
known-third-party = [
"__main__",
# This forces distutils imports to always be after setuptools
# setuptools must be imported before distutils because it monkey-patches it.
# distutils is also removed in Python 3.12 and deprecated with setuptools
"distutils",
]
extra-standard-library = ["setuptools"]