Skip to content

Commit 96569fa

Browse files
fusion44claude
andcommitted
chore: make the ruff config load, and fix what it then reports
pyproject.toml used `target_version`, which modern ruff rejects as an unknown field -- so ruff failed to parse the config and linted nothing at all. Renaming it to `target-version` surfaced 17 violations. - Move `select`/`ignore`/`fixable`/`unfixable`/`dummy-variable-rgx`/`mccabe` under `[tool.ruff.lint]`, where they now belong. - Exclude app/external/result_type/*, which is vendored third-party code kept close to upstream, alongside the already-excluded generated protos. That accounts for 7 of the 17. - Add per-file E501 ignores for app/apps/docs.py and app/system/impl/native_python.py: their long lines are verbatim example payloads (sample API error bodies, a Nix config snippet) and re-wrapping them would misrepresent what they document. - Wrap three genuinely long lines, drop an unused import and an unused local, and give app/apps/tasks_impl/__init__.py an __all__ for its re-exports. ruff check now passes under both the pinned 0.14.14 and current nixpkgs ruff. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent df240c0 commit 96569fa

7 files changed

Lines changed: 31 additions & 16 deletions

File tree

app/apps/cache.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ async def set_cached_app_status(
113113
return Err(e)
114114

115115
logger.debug(
116-
f"App status cache updated. Key: {AppsServiceKeys.APP_STATUS_MESSAGE_KEY}"
116+
"App status cache updated. Key: "
117+
f"{AppsServiceKeys.APP_STATUS_MESSAGE_KEY}"
117118
)
118119

119120
return Ok(None)

app/apps/tasks_impl/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
from .app_manage import app_manage_task_impl
22
from .app_status_update import update_app_state_task_impl
3+
4+
__all__ = ["app_manage_task_impl", "update_app_state_task_impl"]

app/lightning/models.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,8 @@ def _features(features):
733733

734734
@classmethod
735735
def from_cln_json(cls, i) -> "Invoice":
736-
# Handle missing amount_msat field (e.g., in BOLT12 offers or certain invoice types)
736+
# Handle missing amount_msat field (e.g., in BOLT12 offers or
737+
# certain invoice types)
737738
# Use amount_received_msat if amount_msat is not present and invoice is paid
738739
amt = 0
739740
if "amount_msat" in i:

app/lightning/service.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ async def register_lightning_listener():
211211

212212
async def _handle_info_listener():
213213
last_info = None
214-
last_info_lite = None
215214
while True:
216215
info = await ln.get_ln_info()
217216

app/system/router.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,10 @@ async def get_system_health(
145145
response: Response,
146146
verbose: bool = Query(
147147
False,
148-
description="If true, include a per-subsystem (api, bitcoind, lightning) health breakdown.",
148+
description=(
149+
"If true, include a per-subsystem (api, bitcoind, lightning) "
150+
"health breakdown."
151+
),
149152
),
150153
) -> SystemHealthInfo:
151154
result = await system_health(verbose)

pyproject.toml

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,6 @@ build-backend = "hatchling.build"
5555
profile = "black"
5656

5757
[tool.ruff]
58-
# Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default.
59-
select = ["E", "F"]
60-
ignore = []
61-
62-
# Allow auto fix for all enabled rules (when `--fix`) is provided.
63-
fixable = ["A", "B", "C", "D", "E", "F", "G", "I", "N", "Q", "S", "T", "W", "ANN", "ARG", "BLE", "COM", "DJ", "DTZ", "EM", "ERA", "EXE", "FBT", "ICN", "INP", "ISC", "NPY", "PD", "PGH", "PIE", "PL", "PT", "PTH", "PYI", "RET", "RSE", "RUF", "SIM", "SLF", "TCH", "TID", "TRY", "UP", "YTT"]
64-
unfixable = []
65-
6658
# Exclude a variety of commonly ignored directories.
6759
exclude = [
6860
".bzr",
@@ -86,18 +78,36 @@ exclude = [
8678
"dist",
8779
"node_modules",
8880
"venv",
89-
"app/lightning/impl/protos/*"
81+
# generated from the LND/CLN .proto files
82+
"app/lightning/impl/protos/*",
83+
# vendored third-party Result type, kept close to upstream
84+
"app/external/result_type/*",
9085
]
9186

9287
# Same as Black.
9388
line-length = 88
9489

90+
target-version = "py311"
91+
92+
[tool.ruff.lint]
93+
# Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default.
94+
select = ["E", "F"]
95+
ignore = []
96+
97+
# Allow auto fix for all enabled rules (when `--fix`) is provided.
98+
fixable = ["A", "B", "C", "D", "E", "F", "G", "I", "N", "Q", "S", "T", "W", "ANN", "ARG", "BLE", "COM", "DJ", "DTZ", "EM", "ERA", "EXE", "FBT", "ICN", "INP", "ISC", "NPY", "PD", "PGH", "PIE", "PL", "PT", "PTH", "PYI", "RET", "RSE", "RUF", "SIM", "SLF", "TCH", "TID", "TRY", "UP", "YTT"]
99+
unfixable = []
100+
95101
# Allow unused variables when underscore-prefixed.
96102
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
97103

98-
target_version = "py311"
104+
[tool.ruff.lint.per-file-ignores]
105+
# Long lines here are verbatim example payloads (sample API error bodies, a Nix
106+
# config snippet). Wrapping them would misrepresent what they document.
107+
"app/apps/docs.py" = ["E501"]
108+
"app/system/impl/native_python.py" = ["E501"]
99109

100-
[tool.ruff.mccabe]
110+
[tool.ruff.lint.mccabe]
101111
# Unlike Flake8, default to a complexity level of 10.
102112
max-complexity = 10
103113

tests/test_ws_manager.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import asyncio
22
import json
33

4-
import pytest
54
from starlette.websockets import WebSocketDisconnect
65

76
from app.api.ws_manager import WebSocketManager

0 commit comments

Comments
 (0)