Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 19 additions & 25 deletions .vale.ini
Original file line number Diff line number Diff line change
@@ -1,30 +1,24 @@
StylesPath = .vale/styles

MinAlertLevel = suggestion
# Vale configuration for Aditi
# This file configures Vale to use AsciiDocDITA rules for validating AsciiDoc files

Packages = RedHat, AsciiDoc, OpenShiftAsciiDoc

# Ignore files in dirs starting with `.` to avoid raising errors for `.vale/fixtures/*/testinvalid.adoc` files
[[!.]*.adoc]
BasedOnStyles = RedHat, AsciiDoc, OpenShiftAsciiDoc
StylesPath = .vale/styles
MinAlertLevel = warning

# Disabling rules (NO)
RedHat.ReleaseNotes = NO
# Download the AsciiDocDITA package from GitHub
Packages = https://github.com/jhradilek/asciidoctor-dita-vale/releases/latest/download/AsciiDocDITA.zip

# Use local OpenShiftDocs Vocab terms
Vale.Terms = YES
Vale.Avoid = YES
# Apply AsciiDocDITA rules to all AsciiDoc files
[*.adoc]
BasedOnStyles = AsciiDocDITA

# Disable module specific rules
OpenShiftAsciiDoc.ModuleContainsParentAssemblyComment = NO
OpenShiftAsciiDoc.NoNestingInModules = NO
OpenShiftAsciiDoc.NoXrefInModules = NO
OpenShiftAsciiDoc.IdHasContextVariable = NO
OpenShiftAsciiDoc.NoTocInModules = NO
# Ignore code blocks and inline code to prevent false positives
# (e.g., EntityReference rule flagging entities inside code)
BlockIgnores = \
(?s)^----\n.*?\n----$, \
(?s)^\[source.*?\]\n----\n.*?\n----$, \
`[^`]+`

# Optional: pass doc attributes to asciidoctor before linting
# Temp values are used for Prow CI comment linting only
[asciidoctor]
temp-ifdef = YES
temp-ifndef = NO
temp-ifeval = temp
# You can disable specific rules by uncommenting lines below:
# AsciiDocDITA.ShortDescription = NO
# AsciiDocDITA.ContentType = NO
# AsciiDocDITA.EntityReference = NO
30 changes: 30 additions & 0 deletions .vale.ini.backup.20250804_112358
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
StylesPath = .vale/styles

MinAlertLevel = suggestion

Packages = RedHat, AsciiDoc, OpenShiftAsciiDoc

# Ignore files in dirs starting with `.` to avoid raising errors for `.vale/fixtures/*/testinvalid.adoc` files
[[!.]*.adoc]
BasedOnStyles = RedHat, AsciiDoc, OpenShiftAsciiDoc

# Disabling rules (NO)
RedHat.ReleaseNotes = NO

# Use local OpenShiftDocs Vocab terms
Vale.Terms = YES
Vale.Avoid = YES

# Disable module specific rules
OpenShiftAsciiDoc.ModuleContainsParentAssemblyComment = NO
OpenShiftAsciiDoc.NoNestingInModules = NO
OpenShiftAsciiDoc.NoXrefInModules = NO
OpenShiftAsciiDoc.IdHasContextVariable = NO
OpenShiftAsciiDoc.NoTocInModules = NO

# Optional: pass doc attributes to asciidoctor before linting
# Temp values are used for Prow CI comment linting only
[asciidoctor]
temp-ifdef = YES
temp-ifndef = NO
temp-ifeval = temp
24 changes: 24 additions & 0 deletions .vale.ini.backup.20250808_144711
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Vale configuration for Aditi
# This file configures Vale to use AsciiDocDITA rules for validating AsciiDoc files

StylesPath = .vale/styles
MinAlertLevel = warning

# Download the AsciiDocDITA package from GitHub
Packages = https://github.com/jhradilek/asciidoctor-dita-vale/releases/latest/download/AsciiDocDITA.zip

# Apply AsciiDocDITA rules to all AsciiDoc files
[*.adoc]
BasedOnStyles = AsciiDocDITA

# Ignore code blocks and inline code to prevent false positives
# (e.g., EntityReference rule flagging entities inside code)
BlockIgnores = \
(?s)^----\n.*?\n----$, \
(?s)^\[source.*?\]\n----\n.*?\n----$, \
`[^`]+`

# You can disable specific rules by uncommenting lines below:
# AsciiDocDITA.ShortDescription = NO
# AsciiDocDITA.ContentType = NO
# AsciiDocDITA.EntityReference = NO
30 changes: 30 additions & 0 deletions .vale.ini.original
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
StylesPath = .vale/styles

MinAlertLevel = suggestion

Packages = RedHat, AsciiDoc, OpenShiftAsciiDoc

# Ignore files in dirs starting with `.` to avoid raising errors for `.vale/fixtures/*/testinvalid.adoc` files
[[!.]*.adoc]
BasedOnStyles = RedHat, AsciiDoc, OpenShiftAsciiDoc

# Disabling rules (NO)
RedHat.ReleaseNotes = NO

# Use local OpenShiftDocs Vocab terms
Vale.Terms = YES
Vale.Avoid = YES

# Disable module specific rules
OpenShiftAsciiDoc.ModuleContainsParentAssemblyComment = NO
OpenShiftAsciiDoc.NoNestingInModules = NO
OpenShiftAsciiDoc.NoXrefInModules = NO
OpenShiftAsciiDoc.IdHasContextVariable = NO
OpenShiftAsciiDoc.NoTocInModules = NO

# Optional: pass doc attributes to asciidoctor before linting
# Temp values are used for Prow CI comment linting only
[asciidoctor]
temp-ifdef = YES
temp-ifndef = NO
temp-ifeval = temp
69 changes: 69 additions & 0 deletions .vale/styles/AsciiDocDITA/AdmonitionTitle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Report that admonition titles are not supported.
---
extends: script
message: "Admonition titles are not supported in DITA."
level: warning
scope: raw
script: |
text := import("text")
matches := []

r_comment_line := text.re_compile("^(//|//[^/].*)$")
r_comment_block := text.re_compile("^/{4,}\\s*$")
r_block_title := text.re_compile("^\\.{1,2}[^ \\t.].*$")
r_admonition_para := text.re_compile("^(?:NOTE|TIP|IMPORTANT|WARNING|CAUTION):[ \\t]")
r_admonition_block := text.re_compile("^\\[(?:NOTE|TIP|IMPORTANT|WARNING|CAUTION)\\][ \\t]*$")
r_empty_line := text.re_compile("^[ \\t]*$")

document := text.split(text.trim_suffix(scope, "\n"), "\n")

in_comment_block := false
expect_title := false
expect_admonition := false
start := 0
end := 0

for line in document {
start += end
end = len(line) + 1

if r_comment_block.match(line) {
delimiter := text.trim_space(line)
if ! in_comment_block {
in_comment_block = delimiter
} else if in_comment_block == delimiter {
in_comment_block = false
}
continue
}
if in_comment_block { continue }
if r_comment_line.match(line) { continue }
if r_empty_line.match(line) { continue }

if r_block_title.match(line) {
if expect_title {
matches = append(matches, {begin: start, end: start + end - 1})
expect_title = false
expect_admonition = false
} else {
expect_admonition = {begin: start, end: start + end - 1}
}
} else if r_admonition_block.match(line) {
if expect_admonition {
matches = append(matches, expect_admonition)
expect_admonition = false
expect_title = false
} else {
expect_title = true
}
} else if r_admonition_para.match(line) {
if expect_admonition {
matches = append(matches, expect_admonition)
expect_admonition = false
}
expect_title = false
} else {
expect_title = false
expect_admonition = false
}
}
40 changes: 40 additions & 0 deletions .vale/styles/AsciiDocDITA/AttributeReference.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Report custom attribute references.
---
extends: existence
message: "%s"
level: suggestion
scope: raw
nonword: true
tokens:
- '(?<!\$)\{([0-9A-Za-z_][0-9A-Za-z_-]*|set:.+?|counter2?:.+?)\}'
exceptions:
- blank
- empty
- sp
- nbsp
- zwsp
- wj
- apos
- quot
- lsquo
- rsquo
- ldquo
- rdquo
- deg
- plus
- brvbar
- vbar
- amp
- lt
- gt
- startsb
- endsb
- caret
- asterisk
- tilde
- backslash
- backtick
- two-colons
- two-semicolons
- cpp
- pp
53 changes: 53 additions & 0 deletions .vale/styles/AsciiDocDITA/AuthorLine.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Report accidental author lines.
---
extends: script
message: "Author lines are not supported for topics."
level: warning
scope: raw
script: |
text := import("text")
matches := []

r_comment_line := text.re_compile("^(//|//[^/].*)$")
r_comment_block := text.re_compile("^/{4,}\\s*$")
r_document_title := text.re_compile("^=[ \\t]+\\S.*$")
r_attribute := text.re_compile("^:!?\\S[^:]*:")

document := text.split(text.trim_suffix(scope, "\n"), "\n")

in_comment_block := false
need_empty_line := false
start := 0
end := 0

for line in document {
start += end
end = len(line) + 1

if r_comment_block.match(line) {
delimiter := text.trim_space(line)
if ! in_comment_block {
in_comment_block = delimiter
} else if in_comment_block == delimiter {
in_comment_block = false
}
continue
}
if in_comment_block { continue }
if r_comment_line.match(line) { continue }

if r_document_title.match(line) {
if need_empty_line {
matches = append(matches, {begin: start, end: start + end - 1})
break
}
need_empty_line = true
} else if need_empty_line {
if r_attribute.match(line) {
continue
} else if text.trim_space(line) != "" {
matches = append(matches, {begin: start, end: start + end - 1})
}
break
}
}
81 changes: 81 additions & 0 deletions .vale/styles/AsciiDocDITA/BlockTitle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Report unsupported block titles.
---
extends: script
message: "Block titles can only be assigned to examples, figures, and tables in DITA."
level: warning
scope: raw
script: |
text := import("text")
matches := []

r_add_resources := text.re_compile("^\\.{1,2}Additional resources[ \\t]*$")
r_attribute_list := text.re_compile("^\\[(?:|[\\w.#%{,\"'].*)\\][ \\t]*$")
r_attribute := text.re_compile("^:!?\\S[^:]*:")
r_block_title := text.re_compile("^\\.{1,2}[^ \\t.].*$")
r_comment_block := text.re_compile("^/{4,}\\s*$")
r_comment_line := text.re_compile("^(//|//[^/].*)$")
r_conditional := text.re_compile("^(?:ifn?def|ifeval|endif)::\\S*\\[.*\\][ \\t]*$")
r_content_type := text.re_compile("^:_(?:mod-docs-content|content|module)-type:[ \\t]+(?i:procedure)")
r_empty_line := text.re_compile("^[ \\t]*$")
r_example_block := text.re_compile("^\\[example\\][ \\t]*$")
r_example_delim := text.re_compile("^={4,}[ \\t]*$")
r_image := text.re_compile("^image::(?:\\S|\\S.*\\S)\\[.*\\][ \\t]*$")
r_supported_title := text.re_compile("^\\.{1,2}(?:Prerequisites?|Procedure|Verification|Results?|Troubleshooting|Troubleshooting steps?|Next steps?)[ \\t]*$")
r_table_cell := text.re_compile("^\\.[^ \\t|]+\\|")
r_table := text.re_compile("^\\|={3,}[ \\t]*$")

document := text.split(text.trim_suffix(scope, "\n"), "\n")

in_comment_block := false
is_procedure := false
expect_block := false
start := 0
end := 0

for line in document {
start += end
end = len(line) + 1

if r_comment_block.match(line) {
delimiter := text.trim_space(line)
if ! in_comment_block {
in_comment_block = delimiter
} else if in_comment_block == delimiter {
in_comment_block = false
}
continue
}
if in_comment_block { continue }
if r_comment_line.match(line) { continue }

if r_content_type.match(line) {
is_procedure = true
continue
}

if r_attribute_list.match(line) && ! r_example_block.match(line) { continue }
if r_attribute.match(line) { continue }
if r_conditional.match(line) { continue }
if r_empty_line.match(line) { continue }

if r_block_title.match(line) {
if is_procedure && r_supported_title.match(line) { continue }
if r_add_resources.match(line) { continue }
if r_table_cell.match(line) { continue }

expect_block = {begin: start, end: start + end -1}
continue
}

if r_table.match(line) || r_image.match(line) ||
r_example_block.match(line) || r_example_delim.match(line) {
expect_block = false
continue
}

if expect_block {
matches = append(matches, expect_block)
}

expect_block = false
}
9 changes: 9 additions & 0 deletions .vale/styles/AsciiDocDITA/ConditionalCode.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Report conditional directives.
---
extends: existence
message: "%s"
level: suggestion
scope: raw
nonword: true
tokens:
- '^(?:ifn?def|ifeval)::\S*\[.*\][ \t]*$'
Loading