ruff format の対象から Markdown を外す - #15
Merged
Merged
Conversation
ruff format は Markdown 内の Python コードブロックも既定で整形対象にする。 このリポジトリの README には Python のコード例が無いので今は差分が出ないが、 1つ足しただけで CI が落ちる状態だった。 ruff check のほうは Markdown を見ない("No Python files found" を返す)ので、 lint と format のスコープを揃える意味もある。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BsERiWbzZwB6EdGoyyqcpT
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.
ruff formatの対象から Markdown を外します。#28 に入れ損ねた小さな追い足しです。なぜ
ruff formatは Markdown 内の Python コードブロックも既定で整形対象にします。 これは今回まで気づいていませんでした。一方で
ruff checkは Markdown を見ません。.mdを直接渡すとNo Python files found under the given path(s)を返します。lint はしないのに format はする、という非対称になっています。このリポジトリの
README.mdとCLAUDE.mdのコードブロックは bash だけなので今は差分が出ませんが、Python のコード例を1つ足しただけでruff format --check .が落ちる状態でした。ドキュメントを直したら CI が赤くなる、という壊れ方をします。実際に別のリポジトリ(unitrad-moon-age)では、
CLAUDE.mdに書かれた設計メモの擬似コードがruff format .で書き換えられました(48行削除・18行追加)。関数シグネチャの折り返しが1行に畳まれ、クォートが single に変わる、という変更です。設計メモの擬似コードを整形する意味はありません。変更
これで
ruff formatの対象が5ファイル(.py3 +.md2)から**3ファイル(.pyのみ)**になります。CLAUDE.mdの Lint の節にも一行書き足しました。確認
関連
同じ変更を ndc-dev/api と unitrad-moon-age にも入れています。
Todoist: Python の lint を ruff に統一する(5リポジトリ)
🤖 Generated with Claude Code
https://claude.ai/code/session_01BsERiWbzZwB6EdGoyyqcpT