Skip to content

Commit 10b505d

Browse files
committed
Tweaking Vale config to ensure ocpasciidoc rules fire
1 parent f574b67 commit 10b505d

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

.vale.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ MinAlertLevel = suggestion
44

55
Packages = RedHat, AsciiDoc, OpenShiftAsciiDoc
66

7-
Vocab = OpenShiftDocs
8-
97
# Ignore files in dirs starting with `.` to avoid raising errors for `.vale/fixtures/*/testinvalid.adoc` files
108
[[!.]*.adoc]
119
BasedOnStyles = RedHat, AsciiDoc, OpenShiftAsciiDoc
1210

11+
Vocab = OpenShiftDocs
12+
1313
# Disabling rules (NO)
1414
RedHat.ReleaseNotes = NO
1515

modules/.vale.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ StylesPath = ../.vale/styles
22

33
MinAlertLevel = suggestion
44

5-
Vocab = OpenShiftDocs
6-
75
[[!.]*.adoc]
86
BasedOnStyles = OpenShiftAsciiDoc, AsciiDoc, RedHat
97

8+
Vocab = OpenShiftDocs
9+
1010
# Use local OpenShiftDocs Vocab terms
1111
Vale.Terms = YES
1212
Vale.Avoid = YES

scripts/prow-vale-review.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,18 @@ function get_vale_errors {
4242
# Run vale with the custom template on updated files and determine if a review comment should be posted
4343
for FILE in ${FILES};
4444
do
45+
# Check if Vale should use the modules config or the root config. Ensures correct rule enabling/disabling
46+
if [[ $FILE == modules/* ]]; then
47+
INI="modules/.vale.ini"
48+
else
49+
INI=".vale.ini"
50+
fi
51+
4552
# Update conditional markup in place
4653
sed -i 's/ifdef::.*/ifdef::temp-ifdef[]/; s/ifeval::.*/ifeval::["{temp-ifeval}" == "temp"]/; s/ifndef::.*/ifndef::temp-ifndef[]/; s/endif::.*/endif::[]/;' "$FILE"
4754

4855
# Parse for vale errors
49-
vale_json=$(vale --minAlertLevel=error --output=.vale/templates/bot-comment-output.tmpl "$FILE" | jq)
56+
vale_json=$(vale --minAlertLevel=error --output=.vale/templates/bot-comment-output.tmpl --config="$INI" "$FILE" | jq)
5057

5158
# Check if there are Vale errors before processing the file further.
5259
if [[ "$vale_json" != "[]" ]]; then

0 commit comments

Comments
 (0)