Repository navigation
Expand file tree
/
Copy pathruff.toml
More file actions
72 lines (62 loc) · 2.61 KB
/
Copy pathruff.toml
File metadata and controls
72 lines (62 loc) · 2.61 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
# Exclude a variety of commonly ignored directories.
exclude = [
"*/migrations/*",
"docs",
"examples",
"static",
"vendor",
"venv",
# TODO this file has what looks like some bugs, so I don't want to mess with it
"apps/testclient/management/commands/create_test_users_and_applications_batch.py"
]
line-length = 120
indent-width = 4
# Python 3.12
target-version = "py312"
# Always output exactly which violations were fixed
show-fixes = true
[lint]
# These are recommended by Ruff documentation: https://docs.astral.sh/ruff/linter/
# TODO: Consider adding more rulesets in the future.
select = [
"E", # pycodestyle errors
"F", # Pyflakes
"W", # pycodestyle warnings
"I", # isort
"TID252", # no relative imports
"RUF100", # unused-noqa
]
ignore = [
"W191", # Tab indentation, handled by formatter
"W293", # Blank line contains whitespace, handled by formatter
"E111", # Indentation with invalid multiple, handled by formatter
"E114", # Indentation with invalid multiple, in comments handled by formatter
"E117", # Over-indented code, handled by formatter
"E501" # Line too long, handled by formatter
]
# Explicitly automatically allow only these safe, structural fixes when using --fix flag from pre-commit.
# These were chosen as a result of BB2-4744. For more information on why each was chosen,
# got to https://confluence.cms.gov/spaces/BB2/pages/1708788696/BB2-4744+Investigate+Ruff+--fix+arg
fixable = [
"I", # Sort imports, takes care of I001 and I002
"E713", # Safe rewrite: 'not x in y' -> 'x not in y'
"E714", # Safe rewrite: 'not x is y' -> 'x is not y'
"F401", # Remove unused imports
"F504", # Clear harmless printf-style (%) extra named arguments
"F522", # Clear harmless extra .format() named arguments
"F523", # Clear harmless extra .format() positional arguments
"F541", # Remove useless f-string prefixes
"F901", # Automatically correct raise NotImplemented errors
"W605", # Convert invalid escape strings to raw/double-escaped strings
"RUF100" # Clear out stale, unused # noqa statements safely
]
# Block all other auto-fixes as a strict safety fallback
unfixable = ["ALL"]
[format]
quote-style = "single"
# Like Black, indent with spaces, rather than tabs.
indent-style = "space"
# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false
# Like Black, automatically detect the appropriate line ending.
line-ending = "auto"