Skip to content

Commit d1fd3ef

Browse files
authored
fix: revert improper config changes
1 parent 1dc3b3b commit d1fd3ef

1 file changed

Lines changed: 93 additions & 55 deletions

File tree

pyproject.toml

Lines changed: 93 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -102,66 +102,104 @@ target-version = "py310"
102102
line-length = 100
103103

104104
[tool.ruff.lint]
105-
select = [ "B", "C4", "E", "F", "FIX", "I", "RET", "S", "SIM", "T10", "TCH", "UP", "W"]
105+
# Select rule categories to enforce
106+
select = [
107+
# Core Python errors and style
108+
"E", # pycodestyle errors
109+
"F", # pyflakes
110+
"W", # pycodestyle warnings
111+
"I", # isort
112+
"B", # flake8-bugbear - common bugs/design issues
113+
"C4", # flake8-comprehensions - simplify comprehensions
114+
"UP", # pyupgrade - modern Python features/idioms
115+
"RET", # flake8-return - cleaner return statements
116+
"SIM", # flake8-simplify - code simplification
117+
"S", # flake8-bandit - security issues
118+
"TCH", # flake8-type-checking - type annotation improvements
119+
"T10", # flake8-debugger - detect debugger calls/imports
120+
"FIX", # flake8-fixme - detect FIXME, TODO, XXX comments
121+
]
122+
123+
# Rules to ignore
106124
ignore = [
107125
"E501",
108-
"B904",
109-
"B006",
110-
"B007",
111-
"B012",
112-
"B028",
113-
"FIX002",
114-
"FIX004",
115-
"SIM102",
116-
"SIM105",
117-
"SIM108",
118-
"SIM113",
119-
"SIM114",
120-
"SIM115",
121-
"SIM116",
122-
"SIM117",
123-
"B018",
124-
"RET501",
125-
"RET502",
126-
"RET503",
127-
"RET504",
128-
"RET505",
129-
"RET506",
130-
"RET507",
131-
"RET508",
132-
"S101",
133-
"S102",
134-
"S105",
135-
"S110",
136-
"S112",
137-
"S113",
138-
"S202",
139-
"S307",
140-
"S311",
141-
"S603",
142-
"S607",
143-
"C416",
144-
"C408",
145-
"C417",
146-
"C414",
147-
"C401",
148-
"C409",
149-
"C419",
150-
"SIM101",
151-
"SIM103",
152-
"SIM110",
153-
"SIM118",
154-
"SIM401",
155-
"SIM910",
156-
"TC001",
157-
"TC003",
158-
"TC006",
159-
"UP028",
126+
127+
# Specific bugbear issues
128+
"B904", # Use 'raise from' in except blocks
129+
"B006", # Mutable default arguments
130+
"B007", # Loop control variable not used within loop body
131+
"B012", # Jump statements in finally blocks
132+
"B028", # No explicit stacklevel in warnings
133+
134+
# FIXME/TODO comments - these are intentional markers for future work
135+
"FIX002", # Line contains TODO
136+
"FIX004", # Line contains HACK
137+
138+
# Code structure preferences
139+
"SIM102", # Use a single if statement instead of nested if statements
140+
"SIM105", # Use contextlib.suppress instead of try-except-pass
141+
"SIM108", # Use ternary operator instead of if-else block
142+
"SIM113", # Use enumerate instead of manually incrementing counter
143+
"SIM114", # If branches with identical arm bodies (combine with or)
144+
"SIM115", # Use context manager for opening files
145+
"SIM116", # Use dictionary instead of if-statements
146+
"SIM117", # Multiple with statements
147+
"B018", # Useless expression
148+
149+
# Return statement style
150+
"RET501", # Do not explicitly return None
151+
"RET502", # Implicit return at the end of function able to return non-None value
152+
"RET503", # Missing explicit return at the end of function able to return non-None value
153+
"RET504", # Unnecessary assignment before return
154+
"RET505", # Unnecessary else after return
155+
"RET506", # Unnecessary else after raise
156+
"RET507", # Unnecessary else after continue
157+
"RET508", # Unnecessary else after break
158+
159+
# Security issues (allow common patterns in the codebase)
160+
"S101", # Use of assert (many asserts are used for type checking)
161+
"S102", # Use of exec (needed in some specific places)
162+
"S105", # Hardcoded password string
163+
"S110", # Try-except-pass (common pattern for handling optional features)
164+
"S112", # Try-except-continue
165+
"S113", # Request without timeout
166+
"S202", # Tarfile unsafe members
167+
"S307", # Use of eval
168+
"S311", # Suspicious non-cryptographic random usage
169+
"S603", # Subprocess without shell=True
170+
"S607", # Start process with partial path
171+
172+
# Style/readability issues (improve incrementally)
173+
"C416", # Unnecessary comprehension (rewrite using list/set/dict)
174+
"C408", # Unnecessary dict() call (rewrite as literal)
175+
"C417", # Unnecessary map usage (replace with generator)
176+
"C414", # Unnecessary list/dict call within another function
177+
"C401", # Unnecessary generator (rewrite as comprehension)
178+
"C409", # Unnecessary literal within tuple/list/dict call
179+
"C419", # Unnecessary comprehension in call
180+
"SIM101", # Duplicate isinstance call
181+
"SIM103", # Needless boolean conversion
182+
"SIM110", # Reimplemented builtin
183+
"SIM118", # Use 'key in dict' instead of 'key in dict.keys()'
184+
"SIM401", # Use dict.get instead of if-else block
185+
"SIM910", # Use dict.get(key) instead of dict.get(key, None)
186+
"TC001", # Move application import into type-checking block
187+
"TC003", # Move standard library import into type-checking block
188+
"TC006", # Add quotes to type expression in `typing.cast()`
189+
"UP028", # Replace yield over for loop with yield from
160190
]
161191

162192
[tool.ruff.lint.per-file-ignores]
163-
"**/tests/**/*.py" = [ "D", "E501", "S101", "B011"]
164-
"**/conftest.py" = ["F401", "F841"]
193+
"**/tests/**/*.py" = [
194+
"D", # Don't require docstrings in tests
195+
"E501", # Line length in tests is less critical
196+
"S101", # Allow assert in tests
197+
"B011", # Allow assert False in tests (common pattern)
198+
]
199+
"**/conftest.py" = [
200+
"F401", # Unused imports in conftest.py are often for fixtures
201+
"F841", # Allow unused variables in conftest (often for fixture side effects)
202+
]
165203

166204
[tool.ruff.lint.pydocstyle]
167205
convention = "google"

0 commit comments

Comments
 (0)