Repository navigation
fix(knip): ツール生成のドットフォルダの除外を戻してゲートを直す - #71
Merged
Merged
Conversation
main (9911dd9) で `pnpm knip` が exit 1 で落ちる。ツールが生成する .remember/ と .understand-anything/ の中のファイルを未使用ファイルとして 挙げるためである。 ## なぜ一度外したのか 直前のマージで knip.jsonc から `"ignore": ["**/.*/**"]` を外した。根拠は knip 自身が出した Configuration hint (`**/.*/** knip.jsonc Remove from ignore`) だったが、このヒントは、判定を行った作業ツリーにそうしたドット フォルダが無かったから出たものだった。これらのフォルダは追跡しておらず、 作業する人の環境によって在ったり無かったりする。 ## なぜ戻すのか フォルダが在る作業ツリーでは、外したままだと `pnpm knip` が落ちる。5 つの ゲートの 1 つが既定ブランチで壊れた状態になる。ヒントに従ってよいかは、 そうしたフォルダが在る環境で確かめなければ判定できないので、その判定の 条件をコメントに残したうえで指定を戻す。 入れ子の .gitignore (例: .remember/.gitignore の `*`) では knip に伝わらない。 リポジトリ直下の .gitignore に1つずつ足せば伝わることは測ったが、それでは ツールが増えるたびに触ることになるので採らない。 ## 測ったこと 2026-09-18、knip 6.31.0、main (9911dd9) を基点にした作業ツリーで測った。 ドットフォルダが在る作業ツリーでは、指定を外した状態が exit 1 (未使用ファイル 6 件)、戻した状態が exit 0。 ドットフォルダが無い作業ツリーでは、戻した状態でも Configuration hint が 出るだけで exit 0 のまま。lint / knip / typecheck / test / build の 5 つは いずれも exit 0。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
何が起きているか
main (9911dd9) で
pnpm knipが exit 1 で落ちる。5 つのゲート (lint / knip /typecheck / test / build) の 1 つが既定ブランチで壊れている。
ツールが生成するドットフォルダ (
.remember/,.understand-anything/) の中のファイルを、knip が未使用ファイルとして挙げるためである。これらのフォルダは
リポジトリが追跡しておらず、CI のチェックアウトには存在しないので、CI は
通ったままになる。
原因
直前のマージ (#68) で knip.jsonc から
"ignore": ["**/.*/**"]を外した。根拠は knip 自身が出した Configuration hint である。
このヒントは、判定を行った作業ツリーにそうしたドットフォルダが無かったから
出たものだった。knip 6.31.0 で測った範囲では、この指定に一致するファイルが
1 つも無い作業ツリーでヒントが出て、在る作業ツリーでは出なかった。つまり
フォルダが無い環境でだけ「不要だから外せ」と読める出力になる。フォルダが
在る環境では同じ指定が必要で、外すと落ちる。
入れ子の .gitignore (例:
.remember/.gitignoreの*) では knip に伝わらない。リポジトリ直下の .gitignore に 1 つずつ足せば伝わることは測ったが、それでは
ツールが増えるたびに触ることになるので採らない。
直す内容
knip.jsonc のトップレベルに
"ignore": ["**/.*/**"]を戻し、次のことをコメントに残した。
ignoresのコメントにあること (同じ判断が 2 か所にあるので、内容を複製せずそちらを指す)
Configuration hint は「判定した環境にフォルダが無かった」ことしか示さないこと
pnpm knipが exit 1 で落ちること必要があること
検証
2026-09-18、knip 6.31.0、main (9911dd9) を基点にして測った。
ドットフォルダが在る作業ツリーで測ったもの (これが要点で、ドットフォルダが
無い作業ツリーで測っても、指定の有無で結果が変わらないため意味がない)。
上の表の「指定なし」が変異でもある。
"ignore"の指定を取り除くとpnpm knipが落ちるので、この指定が効いていることを測れている。
ドットフォルダが無い作業ツリーでは、指定ありでも Configuration hint が出るだけで
exit 0 のまま。CI もこちらに当たるので、この PR で CI の結果は変わらない。
5 つのゲートはいずれも exit 0 (lint / knip / typecheck / test / build)。
🤖 Generated with Claude Code