Skip to content

Commit

Permalink
Merge pull request rohennes#54 from aireilly/unclosed-id-rule
Browse files Browse the repository at this point in the history
New AsciiDoc rules - catch unclosed attr blocks, catch unclosed id quotes
  • Loading branch information
rohennes authored and aireilly committed Apr 28, 2023
2 parents 4c53c2e + 093e41b commit dc75bbf
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .vale/fixtures/AsciiDoc/ClosedAttributeBlocks/.vale.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
; Vale configuration file to test the `ClosedAttributeBlocks` rule
StylesPath = ../../../styles
MinAlertLevel = error
[*.adoc]
AsciiDoc.ClosedAttributeBlocks = YES
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//vale-fixture
:_content-type: ASSEMBLY
[id="rosa-getting-started
= Comprehensive guide to getting started with {product-title}

//vale-fixture
:_content-type: ASSEMBLY
[id="rosa-getting-started_{context}
= Another guide to getting started
10 changes: 10 additions & 0 deletions .vale/fixtures/AsciiDoc/ClosedAttributeBlocks/testvalid.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//vale-fixture
:_content-type: ASSEMBLY
[id="rosa-getting-started_{context}"]
= Comprehensive guide to getting started with {product-title}

.Example output
[source,terminal]
----
{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up","endpoint":"web","instance":"10.129.0.46:8080","job":"prometheus-example-app","namespace":"ns1","pod":"prometheus-example-app-68d47c4fb6-jztp2","service":"prometheus-example-app"},"value":[1591881154.748,"1"]}]}}
----
5 changes: 5 additions & 0 deletions .vale/fixtures/AsciiDoc/ClosedIdQuotes/.vale.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
; Vale configuration file to test the `ClosedIdQuotes` rule
StylesPath = ../../../styles
MinAlertLevel = error
[*.adoc]
AsciiDoc.ClosedIdQuotes = YES
7 changes: 7 additions & 0 deletions .vale/fixtures/AsciiDoc/ClosedIdQuotes/testinvalid.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//vale-fixture
[id="rosa-getting-started_{context}]
= Comprehensive guide to getting started with {product-title}

//vale-fixture
[id="rosa-getting-started]
= Another guide to getting started
4 changes: 4 additions & 0 deletions .vale/fixtures/AsciiDoc/ClosedIdQuotes/testvalid.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
//vale-fixture
:_content-type: ASSEMBLY
[id="rosa-getting-started_{context}"]
= Comprehensive guide to getting started with {product-title}
7 changes: 7 additions & 0 deletions .vale/styles/AsciiDoc/ClosedAttributeBlocks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
extends: existence
scope: raw
level: error
message: "Attribute block is not closed."
raw:
- '(?<!.)\[.*(?<!\])\n'
7 changes: 7 additions & 0 deletions .vale/styles/AsciiDoc/ClosedIdQuotes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
extends: existence
scope: raw
level: error
message: "Quoted ID value is not closed."
raw:
- '(?<!.)\[id\=\".*(?<!\")\]'

0 comments on commit dc75bbf

Please sign in to comment.