Skip to content

Commit 80c32f7

Browse files
authored
Merge pull request #4773 from ClickHouse/vale-fixes
Auditing Vale Rules and Including a Report Script
2 parents 1d8f2c3 + f971dd7 commit 80c32f7

File tree

5 files changed

+60
-4
lines changed

5 files changed

+60
-4
lines changed

.vale.ini

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
StylesPath = styles
2-
MinAlertLevel = warning
32

4-
[*.{md}]
3+
# Exclude with more specific patterns
4+
# [!docs/engines/**/*.md]
5+
# [!docs/development/**/*.md]
6+
# [!docs/interfaces/**/*.md]
7+
# [!docs/operations/**/*.md]
8+
# [!docs/sql-reference/**/*.md]
9+
[!docs/whats-new/**/*.md]
10+
[!docs/releases/**/*.md]
11+
12+
# Only check .md files (not .mdx)
13+
[docs/**/*.md]
514
BasedOnStyles = ClickHouse
15+
16+
ClickHouse.SentenceLength = NO
17+
ClickHouse.FutureTense = NO

scripts/vale/vale-report.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
# vale-report.sh - Generate Vale report
3+
4+
vale docs/ \
5+
--glob='!docs/whats-new/**/*.md' \
6+
--output=JSON > vale-report.json 2>&1
7+
8+
# Check if vale-report.json is valid JSON
9+
if ! jq empty vale-report.json 2>/dev/null; then
10+
echo "Error: Vale did not produce valid JSON output"
11+
echo ""
12+
echo "Vale output:"
13+
cat vale-report.json
14+
exit 1
15+
fi
16+
17+
echo "================================================"
18+
echo "Vale Report - $(date '+%Y-%m-%d')"
19+
echo "================================================"
20+
echo ""
21+
22+
WARNINGS=$(jq '[.[] | .[] | select(.Severity == "warning")] | length' vale-report.json)
23+
SUGGESTIONS=$(jq '[.[] | .[] | select(.Severity == "suggestion")] | length' vale-report.json)
24+
25+
echo "Warnings: $WARNINGS"
26+
echo "Suggestions: $SUGGESTIONS"
27+
echo ""
28+
29+
echo "Top Warning Rules:"
30+
jq -r '[.[] | .[] | select(.Severity == "warning") | .Check] | group_by(.) | map({rule: .[0], count: length}) | sort_by(-.count) | .[:5] | .[] | "\(.count)\t\(.rule)"' vale-report.json | column -t -s $'\t'
31+
echo ""
32+
33+
echo "Top Files to Fix:"
34+
jq -r 'to_entries | map({file: .key, count: [.value[] | select(.Severity == "warning")] | length}) | map(select(.count > 0)) | sort_by(-.count) | .[:15] | .[] | "\(.count)\t\(.file)"' vale-report.json | column -t -s $'\t'
35+
echo ""
36+
37+
echo "================================================"
38+
echo "To fix a file:"
39+
echo " vale docs/path/to/file.md"
40+
echo " vim docs/path/to/file.md"
41+
echo "================================================"

styles/ClickHouse/CodeblockFences.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ extends: existence
66
message: "Instead of '%s' for the code block, use yaml, ruby, plaintext, markdown, javascript, shell, go, python, dockerfile, or typescript."
77
link: https://docs.gitlab.com/development/documentation/styleguide/#code-blocks
88
vocab: false
9-
level: warning
9+
level: suggestion
1010
scope: raw
1111
raw:
1212
- '\`\`\`(yml|rb|text|md|bash|sh\n|js\n|golang\n|py\n|docker\n|ts|irb)'

styles/ClickHouse/FutureTense.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ message: "Instead of future tense '%s', use present tense."
88
ignorecase: true
99
nonword: true
1010
vocab: false
11-
level: warning
11+
level: suggestion
1212
link: https://docs.gitlab.com/development/documentation/styleguide/word_list/#future-tense
1313
tokens:
1414
- (going to|will|won't)[ \n:]\w*

styles/ClickHouse/Uppercase.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ first: '\b([A-Z]{3,5})\b'
1313
second: '(?:\b[A-Z][a-z]+ )+\(([A-Z]{3,5})\)'
1414
# ... with the exception of these:
1515
exceptions:
16+
- ACH
1617
- ACL
1718
- AJAX
1819
- ALL
@@ -163,6 +164,7 @@ exceptions:
163164
- OTP
164165
- OWASP
165166
- PAT
167+
- PAYG
166168
- PCI-DSS
167169
- PDF
168170
- PEM
@@ -255,6 +257,7 @@ exceptions:
255257
- URI
256258
- URL
257259
- USB
260+
- USD
258261
- UTC
259262
- UTF
260263
- UUID

0 commit comments

Comments
 (0)