fix: enforce strict ruff lint (17 rule sets) across entire repo
- Expand ruff config from E/F to 17 rule sets (B, RUF, SIM, PIE, T20, ARG, ERA, A, BLE, RET, ISC, TCH, UP, C4, PERF) - Fix 907 lint errors across all Python files (GUI, FPGA cosim, schematics scripts, simulations, utilities, tools) - Replace all blind except-Exception with specific exception types - Remove commented-out dead code (ERA001) from cosim/simulation files - Modernize typing: deprecated typing.List/Dict/Tuple to builtins - Fix unused args/loop vars, ambiguous unicode, perf anti-patterns - Delete legacy GUI files V1-V4 - Add V7 test suite, requirements files - All CI jobs pass: ruff (0 errors), py_compile, pytest (92/92), MCU tests (20/20), FPGA regression (25/25)
This commit is contained in:
+25
-1
@@ -24,4 +24,28 @@ target-version = "py312"
|
||||
line-length = 100
|
||||
|
||||
[tool.ruff.lint]
|
||||
select = ["E", "F"]
|
||||
select = [
|
||||
"E", # pycodestyle errors
|
||||
"F", # pyflakes (unused imports, undefined names, duplicate keys, assert-tuple)
|
||||
"B", # flake8-bugbear (mutable defaults, unreachable code, raise-without-from)
|
||||
"RUF", # ruff-specific (unused noqa, ambiguous chars, implicit Optional)
|
||||
"SIM", # flake8-simplify (dead branches, collapsible ifs, unnecessary pass)
|
||||
"PIE", # flake8-pie (no-op expressions, unnecessary spread)
|
||||
"T20", # flake8-print (stray print() calls — LLMs leave debug prints)
|
||||
"ARG", # flake8-unused-arguments (LLMs generate params they never use)
|
||||
"ERA", # eradicate (commented-out code — LLMs leave "alternatives" as comments)
|
||||
"A", # flake8-builtins (LLMs shadow id, type, list, dict, input, map)
|
||||
"BLE", # flake8-blind-except (bare except / overly broad except)
|
||||
"RET", # flake8-return (unreachable code after return, unnecessary else-after-return)
|
||||
"ISC", # flake8-implicit-str-concat (missing comma in list of strings)
|
||||
"TCH", # flake8-type-checking (imports only used in type hints — move behind TYPE_CHECKING)
|
||||
"UP", # pyupgrade (outdated syntax for target Python version)
|
||||
"C4", # flake8-comprehensions (unnecessary list/dict calls around generators)
|
||||
"PERF", # perflint (performance anti-patterns: unnecessary list() in for loops, etc.)
|
||||
]
|
||||
|
||||
[tool.ruff.lint.per-file-ignores]
|
||||
# Tests: allow unused args (fixtures), prints (debugging), commented code (examples)
|
||||
"test_*.py" = ["ARG", "T20", "ERA"]
|
||||
# Re-export modules: unused imports are intentional
|
||||
"v7/hardware.py" = ["F401"]
|
||||
|
||||
Reference in New Issue
Block a user