Laws report a count where they could report the artefacts (violationDetails is unused by 223 of 225 laws)

オープン
#43 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
静か
技術スタック
typescript
領域
tooling

調査の方向性

Start by reading the LawResult definition and the console renderer’s handling of violationDetails, then inspect laws that already populate that channel and laws that count resolved files. For each suitable law, identify the evidence it actually has and report it without removing the aggregate violation line. Done when applicable laws expose useful per-violation evidence and the existing truncation and --verbose behavior still applies.

索引モデルが issue の本文から書いたものです。

説明

enhancement

Split out of #42, which fixed the part that needed no new plumbing: the
suggestions laws already compute are no longer discarded by the renderer.

This is the part that does need plumbing.

The state of it

LawResult has a violationDetails channel — { file, line, column, message } — and the console renderer already displays it under
📁 Affected files:, with truncation and a --verbose override.

Two law files out of 225 populate it.

So the mechanism for "this violation, at this path, on this line" exists,
is rendered, and is almost entirely unused. Laws report an aggregate string
instead: "21 source files lack corresponding test files", "115 magic numbers found". The count is derived from a list the law had in hand and
then let go of.

Why it matters

From the consumer report that prompted #42:

To answer "which 21 files", we wrote a script that walks the tree, pairs
sources with specs and categorises what is left. [...] it found 26 where
the law found 21, and we never learned where the difference lay.

We could not tell whether the 5-file discrepancy was our script being
wrong or the law counting something we could not see, so we could not
argue about the law's correctness on the evidence.

That last sentence is the cost. A law that cannot show its evidence cannot
be argued with, and a law that cannot be argued with gets parked. Our own
detectionLimits are the same idea applied to the law's design; this is
the same honesty applied to its output.

It is also the cheapest false-positive detector we could have. Several of
the defects closed in #41 would have been visible on sight if the law had
named the artefacts — jest.preset.js appearing in a list of "source files
lacking tests" needs no analysis at all.

Scope

  • Populate violationDetails wherever a law counts files it has already
    resolved. Not every law can: some are answering "does this project
    declare X" and have a config key rather than a path — those should carry
    the key and the paths searched.
  • Keep the aggregate violation line. It is the right summary; the detail
    belongs underneath it.
  • Truncation and --verbose are already handled by the renderer.

Deliberately not a single sweep: this is per-law work with a per-law
judgement about what the evidence actually is, and a mass edit that
populates the field with something vague would be worse than the current
honest silence.

主要言語
TypeScript
スター
0
フォーク
0
平均マージ
38分
マージ済み PR(30日)
96

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Rule-Of-Code/RoC のほかの issue

Rule-Of-Code/RoC の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。