chore(ci): tooling estricto (ruff + mypy + shellcheck + pre-commit) - #4
Merged
Conversation
…format Introduce el CI que el flujo de trabajo asumía pero no existía: - .github/workflows/ci.yml: ruff check + ruff format --check + mypy (todos los .py) y bash -n + shellcheck (todos los .sh). Versiones fijadas (ruff==0.15.15) para que CI y pre-commit coincidan. - pyproject.toml: config ruff (E,W,F,I,UP,B,C4,SIM; line-length 120) y mypy (ignore-missing-imports, pragmático). - .pre-commit-config.yaml: ruff(+fix)/ruff-format/shellcheck/varios, mismas versiones. Este commit aplica SOLO los cambios mecánicos y seguros (semánticos-neutros): `ruff format` en los 15 .py (divide one-liners E701/E702) + autofixes seguros (imports sin usar/ordenados, f-strings vacías). Verificado: los 15 compilan; token_refresher.py (producción) corre idéntico. Los arreglos manuales restantes (bare-except, mypy, shellcheck) van en commits aparte. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…serving) Arreglos manuales tras el auto-format, todos neutros en runtime: - ruff (67→0): E722 bare-except -> `except Exception:`; E501 partidas o `# noqa` en strings/URLs no partibles; SIM/C4 simplificaciones equivalentes; F841/B007 vars sin uso. `# noqa: SIM113` en el loop de subida (enumerate start=0 dispararía save/log en la 1ª iteración) y `# noqa: SIM115` en los handles de log globales (abiertos a propósito toda la corrida). - mypy (34→0): anotaciones mínimas (`set[str]`, `Counter`, `Dict[str, Any]`, `TextIO | None`) + `assert ... is not None` antes de usar los log globales. `from __future__ import annotations` en los scripts anotados -> seguro en 3.8. - shellcheck (14→0): SC2164 `cd || exit 1` en runners; SC2155/2162/2295/2034 en upload_to_onedrive.sh. SC1091 excluido (upload.env es host-local). - pyproject: quita `python_version` de mypy (usa runtime 3.13); ci fija mypy==2.1.0. Verificado en local: ruff check + ruff format --check + mypy + shellcheck + bash -n + py_compile, todos exit 0 sobre el repo completo. token_refresher.py (producción) intacto salvo formato. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Qué
Introduce el CI que el flujo de trabajo asumía pero no existía (
gh pr checksno reportaba nada), endurecido sobre todo el repo.Componentes
.github/workflows/ci.yml— dos jobs en cada push/PR:ruff check+ruff format --check+mypysobre los 15.py.bash -n+shellchecksobre los 6.sh.ruff==0.15.15,mypy==2.1.0) → CI y local idénticos.pyproject.toml— config ruff (E,W,F,I,UP,B,C4,SIM; line-length 120) y mypy (ignore-missing-imports, usa runtime)..pre-commit-config.yaml— ruff(+fix)/ruff-format/shellcheck/varios, mismas versiones (pipx install pre-commit && pre-commit install).Refactor a verde (247 ruff + 34 mypy + 14 shellcheck → 0)
Hecho en commits separados y preservando comportamiento (varios son scripts de producción):
4560d2b— solo mecánico:ruff format(divide one-liners) + autofixes seguros.c94fb71— manual:except:→except Exception:, anotaciones de tipo,assertantes de usar handles de log globales,cd || exit 1en runners, etc. Con# noqajustificado donde un "fix" cambiaría comportamiento (p. ej.SIM113en el loop de subida:enumeratearranca en 0 y dispararía un save/log extra en la 1ª iteración).token_refresher.py(corre en la Pi) quedó limpio solo con formato, sin edición manual.Verificación
Gate completo en local con exit 0:
ruff check .·ruff format --check .·mypy(15 archivos, 0 issues) ·shellcheck -e SC1091·bash -n·py_compile. Este PR debe ser el primero en pasar por los checks.🤖 Generated with Claude Code