forked from mhyatt000/crossformer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathruff.toml
More file actions
95 lines (89 loc) · 3.79 KB
/
Copy pathruff.toml
File metadata and controls
95 lines (89 loc) · 3.79 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
target-version = "py311"
line-length = 120
[lint]
# https://docs.astral.sh/ruff/rules/
select = [ # list of rule codes Ruff should check
"E", # pycodestyle (includes E4/E7; whitespace/statement/import style)
"W", # pycodestyle whitespace-specific rules
"F", # pyflakes (undefined names, unused vars/imports, etc.)
"I", # isort (import sorting/merging)
"UP", # pyupgrade: modernize syntax based on target-version
"C4", # flake8-comprehensions: prefer comprehensions / remove redundant wrappers
"SIM", # flake8-simplify: simplify boolean logic / control flow
"PIE", # flake8-pie: small safe cleanups & niceties
"PERF", # perflint: safe micro-optimizations
"ISC", # implicit string concatenation checks (see ignore for ISC001)
"RUF", # Ruff-specific rules (e.g., remove unused `# noqa`)
"C901", # mccabe cyclomatic complexity
#
"T10", # flake8-debugger: breakpoint()/pdb/ipdb/etc.
"T20", # flake8-print: print()/pprint()
]
ignore = [ # exceptions to select
"E741", # ambiguous variable name (like l, O, I)
"F841", # assigned but unused variable
"F821", # undefined name
"E731", # do not assign a lambda (style preference)
"E722", # do not use bare except (style preference)
"E501", # line too long (let the formatter handle wrapping)
"UP035",
"UP015", # Unnecessary mode argument open('r') -> open()
"UP031", # Use format specifiers instead of percent format
#
"F722", # Syntax error in forward annotation: Unexpected token at the end of an expression
# Conflicts with array typing.
"T201", # We use print statements.
"PD008", # Lots of false positives.
"ISC001", # Disabling to support ruff format.
#
"RUF009", # Do not perform function call in dataclass defaults
# "RUF059", # Unpacked variable is never used
"PIE796", # Enum contains duplicate value:
"E402", # module import not at top of file
]
# whitelist potentially 'unsafe' linter fixes
fixable = [
"I", "W", "E4", "E7",
"B", # flake8-bugbear: likely bugs / risky patterns
"C4", # comprehension cleanups
"E702", # Multiple statements on one line (semicolon)
"F401", # unused imports
"F541", # f-string without any placeholders
"UP037", # Remove quotes from type annotation
"SIM", # simplify obvious boolean/control-flow patterns
"SIM113", # Use `enumerate()` for index variable `i` in `for` loop
"PIE", # tiny safe cleanups
"PERF", # safe micro-optimizations
"RUF001", # String contains ambiguous `–` (EN DASH). Did you mean `-` (HYPHEN-MINUS)?
"RUF022", # `__all__` is not sorted
"RUF100", # remove unused `# noqa`
"PTH", # flake8-use-pathlib: prefer pathlib.Path over os.path/open
"UP004", # Class `OpenDRRenderer` inherits from `object`
"UP006", # Use `list` instead of `List` for type annotation
"UP007", # Use `X | Y` for type annotations
"UP028", # Replace `yield` over `for` loop with `yield from`
"UP034", # Avoid extraneous parentheses
"UP045", # Use `X | None` for type annotations
]
# blacklist linter fixes
unfixable = [
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
"RUF059", # Unpacked variable `pos` is never used
]
[lint.per-file-ignores]
"**/__init__.py" = ["F401"] # allow unused imports in top-level __init__.py
"tests/**" = [
"T201","T203",
"C901",
] # allow print/pprint in tests
"crossformer/data/oxe/**/*.py" = ["C901"]
"crossformer/data/dataset.py" = ["C901"]
"scripts/**" = ["C901"]
[lint.mccabe]
max-complexity = 10
[lint.isort]
order-by-type = false
force-single-line = false
force-sort-within-sections = true
single-line-exclusions = ["collections.abc", "typing", "typing_extensions"]
required-imports = ["from __future__ import annotations"]