feat(scripts/styleclaims): count scripts/docshtmlcheck as a tool citation
A style guide section enforced by the docs HTML checker had no way to say so: styleclaims only read markdownlint, MD rules, Vale rules and scripts/check_emdash.sh as tool citations, so a footer naming scripts/docshtmlcheck classified as documentation-only and the coverage table could not count it. Assisted-by: AI
This commit is contained in:
1 parent
8e61ff3afa
commit
b807bcbbc7
3 files changed
+9
-3
No files matched your search
@@ -57,7 +57,7 @@ Headings deeper than `###` are detail inside a section, not rules.
|
||||
A Markdown file that has no footers and no coverage row, such as `editor-setup.md`, isn't a rule section and isn't scanned.
|
||||
|
||||
- **Documentation-only**: the annotation declares the section `Documentation-only`. This wins over everything else, so a section that only cross-references a rule another section owns counts under that other section and no rule is counted twice. The match is case-sensitive; a lowercase "documentation-only" describes part of a section, not the section.
|
||||
- **Tool-checked**: cites as active an enabled Coder rule, a third-party rule whose style `.vale.ini` loads, `markdownlint`, an `MD###` rule, or `scripts/check_emdash.sh`. A Coder rule that exists but is disabled everywhere doesn't count: it checks no file.
|
||||
- **Tool-checked**: cites as active an enabled Coder rule, a third-party rule whose style `.vale.ini` loads, `markdownlint`, an `MD###` rule, `scripts/check_emdash.sh`, or `scripts/docshtmlcheck`. A Coder rule that exists but is disabled everywhere doesn't count: it checks no file.
|
||||
- **Planned**: cites only planned checkers.
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -135,7 +135,7 @@ var annotationStart = regexp.MustCompile(`^\*(Enforced|Documentation-only|Adapte
|
||||
// citation matches a backticked rule or tool name inside an annotation. A Vale
|
||||
// rule is `Style.Rule`; the style alternation is open so a citation to a style
|
||||
// the repo doesn't load is still read as a claim and reported.
|
||||
var citation = regexp.MustCompile("`([A-Z][A-Za-z0-9-]*\\.[A-Za-z0-9_-]+|alex\\.[A-Za-z0-9*]+|write-good\\.[A-Za-z0-9]+|markdownlint|scripts/check_emdash\\.sh|MD[0-9]{3})`")
|
||||
var citation = regexp.MustCompile("`([A-Z][A-Za-z0-9-]*\\.[A-Za-z0-9_-]+|alex\\.[A-Za-z0-9*]+|write-good\\.[A-Za-z0-9]+|markdownlint|scripts/check_emdash\\.sh|scripts/docshtmlcheck|MD[0-9]{3})`")
|
||||
|
||||
// severityCell matches the severity column of a "Checks that run today" row.
|
||||
var severityCell = regexp.MustCompile("`(error|warning|suggestion)`")
|
||||
@@ -767,7 +767,7 @@ func splitSentences(text string) []string {
|
||||
|
||||
// isTool reports whether a citation names a checker outside the Vale styles.
|
||||
func isTool(c string) bool {
|
||||
return c == "markdownlint" || c == "scripts/check_emdash.sh" || strings.HasPrefix(c, "MD")
|
||||
return c == "markdownlint" || c == "scripts/check_emdash.sh" || c == "scripts/docshtmlcheck" || strings.HasPrefix(c, "MD")
|
||||
}
|
||||
|
||||
// classify buckets an annotation for the coverage table.
|
||||
|
||||
@@ -100,6 +100,11 @@ func TestActiveCitations(t *testing.T) {
|
||||
wantActive: []string{"scripts/check_emdash.sh"},
|
||||
wantPlanned: []string{"Coder.EmDash"},
|
||||
},
|
||||
{
|
||||
name: "docs HTML checker",
|
||||
text: "*Enforced by `scripts/docshtmlcheck` for empty header cells.*",
|
||||
wantActive: []string{"scripts/docshtmlcheck"},
|
||||
},
|
||||
{
|
||||
name: "rule named without a claim is ignored",
|
||||
text: "*Documentation-only. No Vale rule. Imprecise rules like `Google.Passive` and `write-good.Passive` fire on every passive construction, so they stay out of the package.*",
|
||||
@@ -141,6 +146,7 @@ func TestClassify(t *testing.T) {
|
||||
}{
|
||||
{"*Enforced by `Coder.BrandNames`.*", classTool},
|
||||
{"*Enforced by `markdownlint` rule `MD040` for the missing-language case.*", classTool},
|
||||
{"*Enforced by `scripts/docshtmlcheck` for empty header cells. The rest is documentation-only.*", classTool},
|
||||
{"*Enforced by `Coder.LearnMore` (planned).*", classPlanned},
|
||||
{"*Documentation-only. No Vale rule.*", classDocumentationOnly},
|
||||
{"*Adapted from ASD-STE100 Issue 9, rule 5.2. Documentation-only. No Vale rule.*", classDocumentationOnly},
|
||||
|
||||
Reference in new issue
Block a user