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:
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user