Skip to content

Commit 1b4e16d

Browse files
authored
Merge pull request #74024 from aireilly/prow-script-ifdef
2 parents ba46bdd + aad8d9f commit 1b4e16d

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

.vale.ini

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ Vocab = OpenShiftDocs
1111
BasedOnStyles = RedHat, AsciiDoc, OpenShiftAsciiDoc
1212

1313
# Optional: pass doc attributes to asciidoctor before linting
14-
#[asciidoctor]
15-
#openshift-enterprise = YES
14+
# Temp values are used for Prow CI comment linting only
15+
[asciidoctor]
16+
temp-ifdef = YES
17+
temp-ifndef = NO
18+
temp-ifeval = temp
1619

1720
# Disabling rules (NO)
1821
RedHat.ReleaseNotes = NO

modules/.vale.ini

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ Vocab = OpenShiftDocs
77
[[!.]*.adoc]
88
BasedOnStyles = OpenShiftAsciiDoc, AsciiDoc, RedHat
99

10+
# Temp values are used for Prow CI comment linting only
11+
[asciidoctor]
12+
temp-ifdef = YES
13+
temp-ifndef = NO
14+
temp-ifeval = temp
15+
1016
# Use local OpenShiftDocs Vocab terms
1117
Vale.Terms = YES
1218
Vale.Avoid = YES

scripts/prow-vale-review.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@ 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-
# Clean out conditional markup in place and parse for vale errors
46-
sed -i 's/ifdef::.*\|ifndef::.*\|ifeval::.*\|endif::.*/ /' "$FILE"
45+
# Update conditional markup in place
46+
sed -i 's/ifdef::.*/ifdef::temp-ifdef[]/; s/ifeval::.*/ifeval::["{temp-ifeval}" == "temp"]/; s/ifndef::.*/ifndef::temp-ifndef[]/; s/endif::.*/endif::[]/;' "$FILE"
47+
48+
# Parse for vale errors
4749
vale_json=$(vale --minAlertLevel=error --output=.vale/templates/bot-comment-output.tmpl "$FILE" | jq)
4850

4951
# Check if there are Vale errors before processing the file further.

0 commit comments

Comments
 (0)