magic-number: numbers that are already named are reported (regex contents, `?? N` config fallbacks, parameter defaults, product factors, radix)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- typescript
- 領域
- tooling
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- TypeScript
- スター
- 0
- フォーク
- 0
- 平均マージ
- 38分
- マージ済み PR(30日)
- 96
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Rule-Of-Code/RoC のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Rule-Of-Code/RoC#436 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
Rule-Of-Code/RoC#439 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 49/100
Rule-Of-Code/RoC#438 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 53/100
Rule-Of-Code/RoC#437 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 74/100
Rule-Of-Code/RoC#435 ·
メンテナーはふだん 1 日以内に返信
Rule-Of-Code/RoC の issue をすべて見る
似ている issue
-
ready-for-agent
難易度 1/5 1時間未満 初心者へのやさしさ 86/100
LucasSantana-Dev/Lucky#3257 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
XiaomiMiMo/MiMo-Code#2849 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
danielmiessler/LifeOS#2894 ·
メンテナーはふだん 5 日以内に返信
-
enhancement frontend good first issue help wanted testing-infrastructure
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 2 日以内に返信
-
enhancement follow-up
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信