feat: scope the comment rule to yaml, yml, and toml too

Adds them to both the paths glob and the linter's extension set, which
had also drifted apart on scala.
This commit is contained in:
naps62
2026-08-01 14:11:08 +00:00
parent ccfb5192f8
commit b8d442386b
2 changed files with 7 additions and 2 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
---
paths:
- "**/*.{ts,tsx,js,jsx,mjs,cjs,py,rs,go,sol,sh,bash,zsh,c,h,cc,cpp,hpp,java,kt,rb,lua,zig,nix,swift,php,cs,ex}"
- "**/*.{ts,tsx,js,jsx,mjs,cjs,py,rs,go,sol,sh,bash,zsh,c,h,cc,cpp,hpp,java,kt,rb,lua,zig,nix,swift,php,cs,scala,ex,yaml,yml,toml}"
---
## Code comments
+6 -1
View File
@@ -15,17 +15,22 @@ import sys
MAX_COMMENT_RUN = 3 # contract budget; past this you are teaching, not warning
# MUST stay in sync with the paths glob in claude-md/code-comments.md — a file
# type in one and not the other either lints without the rule loaded, or loads
# the rule and never lints.
CODE_EXT = {
".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".py", ".rs", ".go", ".sol",
".sh", ".bash", ".zsh", ".c", ".h", ".cc", ".cpp", ".hpp", ".java", ".kt",
".rb", ".lua", ".zig", ".nix", ".swift", ".php", ".cs", ".scala", ".ex",
".yaml", ".yml", ".toml",
}
COMMENT_RE = re.compile(r"^\s*(//+|#+|/\*+|\*+/?|--|;;?)\s?(.*)$")
# Only match syntax the language actually has. In a hash-comment language a `//` or `*` line is
# almost always a string literal holding code for another language, and linting it flags text the
# script is deleting rather than text it is adding.
HASH_ONLY_EXT = {".py", ".sh", ".bash", ".zsh", ".rb", ".ex", ".nix"}
HASH_ONLY_EXT = {".py", ".sh", ".bash", ".zsh", ".rb", ".ex", ".nix",
".yaml", ".yml", ".toml"}
HASH_RE = re.compile(r"^\s*(#+)\s?(.*)$")
# Design rationale, alternatives, history: capped at 1-2 lines, belongs in docs.