magic-number: numbers that are already named are reported (regex contents, `?? N` config fallbacks, parameter defaults, product factors, radix)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
- Ambito
- tooling
Direzione di ricerca
Start with magic-number-prevention.ts, especially lines 168–177 and 224–227, and trace how the detector masks source text and exempts named values. Review its tests for regex literals, nullish coalescing, defaults, products, collections, radix arguments, and template substitutions; the issue gives example source patterns but does not name test files. Done when those false findings are excluded and template substitutions are scanned, while the listed real magic-number findings remain detectable.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Found in the 8.0.0 self-audit triage: RoC 7.29.1 (npm, 5fc54afe) on a clean clone of develop at 2d2fa9a, with typescript resolvable (verdict compliance, 0 failed / 46 warnings). The bucket method and per-law tables are kept by QA; counts are from that run.
What happens
Magic Number Prevention reported 302 literals in 106 files; 40 files contain only these kinds of false findings (re-run of the detector's own loop, 0 mismatches):
- inside regex literals (75 literals): skipped but not blanked (magic-number-prevention.ts:224-227), so
{0,300}is a "magic number"; config.thresholds?.x ?? 50(55): the config key names the number; the exemption only acceptsconst X =orkey:on the same line (:168-177), and misses??at the end of the previous line;- later factors of a named product (
MAX_AGE = 24 * 60 * 60 * 1000, 10), parameter/destructuring defaults (before = 50, 8), elements of a namedSet,parseInt(x, 16).
Also a false negative:${…}inside template literals is blanked, soslice(0, 57)there is never seen.
Real debt remains (66 files): score deductions (score -= 25), unnamed length limits (the same .slice(0, 80) in 5 files), ratio cutoffs, version checks.
Suggested direction
Blank regex contents; treat as named: <chain> ?? N, ident = N in parameters/destructuring, every factor of a product whose first factor is exempt, elements of a named array/Set, the radix argument; scan template substitutions.
- Lingua principale
- TypeScript
- Stelle
- 0
- Fork
- 0
- Merge medio
- 38m
- PR unite (30g)
- 96
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Rule-Of-Code/RoC
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Rule-Of-Code/RoC#436 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
Rule-Of-Code/RoC#439 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 49/100
Rule-Of-Code/RoC#438 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 53/100
Rule-Of-Code/RoC#437 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 74/100
Rule-Of-Code/RoC#435 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di Rule-Of-Code/RoC
Issue simili
-
documentation lens:human needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
thebristolsound/birdbrain#2246 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
A voting window past about 69.9 million hours stores a deadline that reads back as no deadlineApertabug ready-for-human
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
BoardGamesEmpire/board-games-empire-backend#1452 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
good first issue stretch
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno