Skip to content

Commit e168229

Browse files
authored
Update docs-quality.yml
1 parent c931d00 commit e168229

1 file changed

Lines changed: 43 additions & 15 deletions

File tree

.github/workflows/docs-quality.yml

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,22 +44,50 @@ jobs:
4444
- name: Lint docs with Harper
4545
run: |
4646
set -uo pipefail
47-
IGNORED_RULES=(
48-
SpellCheck
49-
OrthographicConsistency
50-
ProperNouns
51-
CompaniesProductsAndTrademarks
52-
OkToOkay
53-
DisjointPrefixes
54-
LongSentences
55-
Hedging
56-
FillerWords
57-
EllipsisLength
58-
SentenceCapitalization
59-
Spaces
47+
ONLY_RULES=(
48+
UseTitleCase
49+
RepeatedWords
50+
UnclosedQuotes
51+
MergeWords
6052
SplitWords
61-
MassNouns
62-
ExpandMemoryShorthands
53+
ItsContraction
54+
ThenThan
55+
TheirToThere
56+
TheyreToTheir
57+
ThereToTheir
58+
)
59+
ONLY_ARG="--only $(IFS=,; echo "${ONLY_RULES[*]}")"
60+
out="$(mktemp)"
61+
total=0
62+
bad=0
63+
while IFS= read -r -d '' file; do
64+
total=$((total+1))
65+
echo "::group::$file"
66+
if harper-cli lint $ONLY_ARG "$file" 2>&1 | tee -a "$out"; then
67+
:
68+
else
69+
bad=$((bad+1))
70+
fi
71+
echo "::endgroup::"
72+
done < <(
73+
find docs src/pages \
74+
-type f \( -name "*.md" -o -name "*.mdx" \) \
75+
-print0 2>/dev/null
76+
)
77+
titlecase=$(grep -c 'Capitalization::UseTitleCase' "$out" || true)
78+
{
79+
echo "### Harper summary"
80+
echo "- Files scanned: $total"
81+
echo "- Files with issues: $bad"
82+
echo "- Heading title case violations: $titlecase"
83+
echo ""
84+
echo "### Violations by rule"
85+
echo '```'
86+
grep -oE '\[[A-Za-z]+::[A-Za-z]+\]' "$out" | sort | uniq -c | sort -rn || true
87+
echo '```'
88+
} >> "$GITHUB_STEP_SUMMARY"
89+
echo "== Harper: $bad/$total files with issues; $titlecase UseTitleCase violations =="
90+
[ "$bad" -eq 0 ] ExpandMemoryShorthands
6391
ExpandDirectory
6492
AnA
6593
NoFrenchSpaces

0 commit comments

Comments
 (0)