Skip to content

fix(sonar): resolve new issues in simplicity guardian - #443

Merged
ngarbezza merged 1 commit into
mainfrom
claude/sonar-issues-5f8916
Oct 17, 2026
Merged

ngarbezza merged 1 commit into
mainfrom
claude/sonar-issues-5f8916

Conversation

@ngarbezza

Copy link
Copy Markdown
Owner

Qué

Corrige los 7 issues nuevos de Sonar (leak period) sobre `main`:

  • S8786 (`bin/simplicity-guardian.js`, 2 issues): las regex de imports usaban `\s+.+?\s+from` (backtracking super-lineal). Se reescriben con clases de caracteres que no se solapan; mismo comportamiento.
  • S7772 (`entrypoint.cjs`, 2 issues): `node:fs` y `node:path`.
  • S5443 (`entrypoint.cjs`, 2 issues): los reportes JSON ya no se escriben en `/tmp` (directorio compartido) sino en `RUNNER_TEMP`; se actualiza el workflow en consecuencia.
  • S2486 (`entrypoint.cjs`): se documenta por qué `safeReadJson` ignora el error y devuelve el fallback.

Tests

  • Casos nuevos para `detectExternalImports` (espacios extra, varios bindings, identificadores que empiezan con `import`, import dinámico).
  • Tests nuevos para `safeReadJson` (archivo válido, inexistente, malformado), con fixtures.
  • `npm test` (496 passing), `npm run lint` y `node bin/simplicity-guardian.js` en verde; el entrypoint se probó localmente con `RUNNER_TEMP` seteado.

🤖 Generated with Claude Code

- S8786: rewrite import regexes to avoid super-linear backtracking
- S7772: use node: prefix for fs/path in the entrypoint
- S5443: write guardian/lint reports to RUNNER_TEMP instead of /tmp
- S2486: document why a malformed report falls back to a default
@ngarbezza
ngarbezza merged commit 95fcfeb into main Oct 17, 2026
5 of 6 checks passed
@ngarbezza
ngarbezza deleted the claude/sonar-issues-5f8916 branch October 17, 2026 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant