Skip to content

Commit

Permalink
Adding trailing backslash rule
Browse files Browse the repository at this point in the history
  • Loading branch information
aireilly committed Nov 6, 2024
1 parent 5b07237 commit 347655f
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .vale/fixtures/OpenShiftAsciiDoc/TrailingBackslash/.vale.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
; Vale configuration file to test the `TrailingBackslash` rule
StylesPath = ../../../styles
MinAlertLevel = suggestion
[*.adoc]
OpenShiftAsciiDoc.TrailingBackslash = YES
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//vale-fixture
[source,terminal]
----
oc get my lunch\
----

//vale-fixture
[source,terminal]
----
C:\Program Files\
----
46 changes: 46 additions & 0 deletions .vale/fixtures/OpenShiftAsciiDoc/TrailingBackslash/testvalid.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
[source,terminal]
----
$ oc get my lunch
----

[source,terminal]
----
# oc get my lunch
----

.Example
[source,terminal]
----
$ az role assignment create --role "<privileged_role>" \// <1>
----

[source,terminal]
----
sh-4.2# chroot /host
----

[source,terminal]
----
.
├── CODEOWNERS
├── README.md
└── scripts
└── validate-vale-rules.sh
----

[source,terminal]
----
(undercloud)$ cd go/to/path
----

[source,yaml]
----
include::yaml/boundary-clock-ptp-config.yaml[]
----

.Example
[source,terminal]
----
$ az role assignment \
create --role "<privileged_role>"
----
9 changes: 9 additions & 0 deletions .vale/styles/OpenShiftAsciiDoc/TrailingBackslash.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
extends: existence
scope: raw
level: error
message: "Codeblock contains unescaped trailing backslash."
action:
name: remove
raw:
- '(?<!^----\n.+\n+\w+)(?<!\\)\\\n'

0 comments on commit 347655f

Please sign in to comment.