Skip to content

Commit

Permalink
Adding trailing backslah rule
Browse files Browse the repository at this point in the history
  • Loading branch information
aireilly committed Oct 29, 2024
1 parent e36be7c commit fa069f1
Show file tree
Hide file tree
Showing 4 changed files with 64 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\
----
39 changes: 39 additions & 0 deletions .vale/fixtures/OpenShiftAsciiDoc/TrailingBackslash/testvalid.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[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[]
----
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: "Unescaped trailing backslash detected in codeblock."
action:
name: remove
raw:
- '(?<!^----\n.*\n*\w*)(?<!\\)\\\n'

0 comments on commit fa069f1

Please sign in to comment.