`execute` (complexity 48) and `execute_cloud` (44) in `command/run/__init__.py`

Abierto
#726 2 comentarios 1 reacción 1 asignado Ver en GitHub

Los mantenedores suelen responder en 1 día

@christian-byrne ya está trabajando en esto.

Desde el 23/8/2026.

Evaluación

Este issue todavía no se ha evaluado.

Descripción

audit:architecture effort:large priority:recommended

What — The two functions on the CLI's primary command path score 48 and 44 on cyclomatic complexity, against a conventional threshold of 10. They are the top two of 90 C901 violations repo-wide; the next worst are 36 (command/generate/app.py:_generate) and 35 (command/models/models.py:download).

Why it matters here — comfy run is the command most users reach for, and its two implementations are the least testable code in the repo. At complexity 48 the branch count is beyond what a test suite can cover exhaustively, so behaviour changes there are effectively unverifiable — which is a bad property for the path that talks to both local and cloud execution. The two functions being near-twins at 48 and 44 also suggests shared structure worth extracting rather than two independent rewrites.

Evidence

$ ruff check --select C901 --output-format concise comfy_cli | sort -t'(' -k2 -rn | head -4
comfy_cli/command/run/__init__.py:204:5: C901 `execute` is too complex (48 > 10)
comfy_cli/command/run/__init__.py:890:5: C901 `execute_cloud` is too complex (44 > 10)
comfy_cli/command/generate/app.py:481:5: C901 `_generate` is too complex (36 > 10)
comfy_cli/command/models/models.py:334:5: C901 `download` is too complex (35 > 10)

$ ruff check --select C901 comfy_cli 2>&1 | tail -1
Found 90 errors.

Fix

Not a single-PR job. Suggested order: diff execute against execute_cloud to find the shared skeleton, extract it, then peel argument validation and output formatting out of both. Add C901 to ruff with max-complexity set at the current worst value so it ratchets down instead of failing on day one.


Found by repo-audit during repo improvement sweep 2026-08-17. Parent: #723

Lenguaje dominante
Python
Estrellas
1k
Forks
176
Merge medio
1 d 11 h
PR fusionados (30 d)
87

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Comfy-Org/comfy-cli

Todos los issues de Comfy-Org/comfy-cli

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.