style: enforce consistent codestyle via ruff config and auto-fixes
- Configure ruff: isort, pyupgrade, bugbear, flake8 rules - Auto-fix import sorting, redundant parens, exception chaining - Remove from __future__ import annotations (Python 3.13+) - Convert debug print() to logger calls - Fix typo applicaiton → application in icon_resolver - Remove bare returns in animator setters - Move TYPE_CHECKING imports to runtime where used at runtime
This commit is contained in:
60 files changed
+243
-217
No files matched your search
+58
-1
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "modus"
|
||||
version = "0.2.0"
|
||||
version = "2.0.0"
|
||||
description = "Add your description here"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.13"
|
||||
@@ -34,9 +34,66 @@ packages = ["src/shared", "src/utils", "src/window", "src/services", "src/global
|
||||
[tool.hatch.build.targets.wheel.sources]
|
||||
"src" = ""
|
||||
|
||||
[tool.ruff]
|
||||
target-version = "py313"
|
||||
line-length = 88
|
||||
|
||||
[tool.ruff.format]
|
||||
quote-style = "double"
|
||||
indent-style = "space"
|
||||
skip-magic-trailing-comma = false
|
||||
line-ending = "auto"
|
||||
|
||||
[tool.ruff.lint]
|
||||
select = [
|
||||
"E", # pycodestyle errors
|
||||
"W", # pycodestyle warnings
|
||||
"F", # pyflakes
|
||||
"I", # isort
|
||||
"UP", # pyupgrade
|
||||
"B", # flake8-bugbear
|
||||
"SIM", # flake8-simplify
|
||||
"C4", # flake8-comprehensions
|
||||
"RET", # flake8-return
|
||||
"RUF", # ruff-specific rules
|
||||
"PIE", # flake8-pie
|
||||
"T20", # flake8-print
|
||||
"PT", # flake8-pytest-style
|
||||
"TCH", # flake8-type-checking
|
||||
"FLY", # flynt (f-string conversion)
|
||||
]
|
||||
ignore = [
|
||||
"T201", # allow print() (used for CLI output)
|
||||
"RET504", # allow unnecessary assignment before return
|
||||
"SIM108", # allow ternary operator (readability)
|
||||
"B008", # allow function calls in default args (common in GTK)
|
||||
"UP007", # allow X | Y union syntax (keep Optional for compatibility)
|
||||
"UP045", # allow Optional[X] annotation style
|
||||
"UP006", # allow typing.List etc (keep for readability)
|
||||
"UP035", # allow deprecated typing imports
|
||||
"RUF012", # allow mutable class attributes (common in GTK widgets)
|
||||
"TC001", # allow runtime imports that happen to be type-only
|
||||
"E501", # line length handled by formatter
|
||||
"RET505", # allow superfluous else after return
|
||||
"B027", # allow empty method bodies (common in ABCs)
|
||||
"B007", # allow unused loop variables
|
||||
"SIM102", # allow collapsible if
|
||||
"SIM105", # allow suppressible exception (contextlib.suppress)
|
||||
"B023", # allow function uses loop variable (closures)
|
||||
"RUF002", # allow ambiguous unicode in docstrings
|
||||
"RUF003", # allow ambiguous unicode in comments
|
||||
"SIM115", # allow open without context handler
|
||||
"SIM116", # allow if-else instead of dict lookup
|
||||
"B018", # allow useless expression (standalone identifiers)
|
||||
]
|
||||
|
||||
[tool.ruff.lint.isort]
|
||||
known-first-party = ["services", "utils", "shared", "window", "globalmenu"]
|
||||
|
||||
[tool.ruff.lint.per-file-ignores]
|
||||
"src/main.py" = ["E402"]
|
||||
"src/window/switcher/main.py" = ["E402"]
|
||||
"examples/**" = ["INP001", "D101", "D102", "D103"]
|
||||
|
||||
[tool.uv.sources]
|
||||
fabric = { git = "https://github.com/Fabric-Development/fabric.git" }
|
||||
Reference in new issue
Block a user