From d2954232e8c927c4b1fc2de86df1c6fb4a3c6ba6 Mon Sep 17 00:00:00 2001 From: Aidan Reilly <74046732+aireilly@users.noreply.github.com> Date: Tue, 29 Oct 2024 15:45:16 +0000 Subject: [PATCH] Adding trailing backslash rule --- .../TrailingBackslash/.vale.ini | 5 ++ .../TrailingBackslash/testinvalid.adoc | 11 +++++ .../TrailingBackslash/testvalid.adoc | 46 +++++++++++++++++++ .../OpenShiftAsciiDoc/TrailingBackslash.yml | 9 ++++ 4 files changed, 71 insertions(+) create mode 100644 .vale/fixtures/OpenShiftAsciiDoc/TrailingBackslash/.vale.ini create mode 100644 .vale/fixtures/OpenShiftAsciiDoc/TrailingBackslash/testinvalid.adoc create mode 100644 .vale/fixtures/OpenShiftAsciiDoc/TrailingBackslash/testvalid.adoc create mode 100644 .vale/styles/OpenShiftAsciiDoc/TrailingBackslash.yml diff --git a/.vale/fixtures/OpenShiftAsciiDoc/TrailingBackslash/.vale.ini b/.vale/fixtures/OpenShiftAsciiDoc/TrailingBackslash/.vale.ini new file mode 100644 index 00000000..77b01392 --- /dev/null +++ b/.vale/fixtures/OpenShiftAsciiDoc/TrailingBackslash/.vale.ini @@ -0,0 +1,5 @@ +; Vale configuration file to test the `TrailingBackslash` rule +StylesPath = ../../../styles +MinAlertLevel = suggestion +[*.adoc] +OpenShiftAsciiDoc.TrailingBackslash = YES diff --git a/.vale/fixtures/OpenShiftAsciiDoc/TrailingBackslash/testinvalid.adoc b/.vale/fixtures/OpenShiftAsciiDoc/TrailingBackslash/testinvalid.adoc new file mode 100644 index 00000000..05e1e31b --- /dev/null +++ b/.vale/fixtures/OpenShiftAsciiDoc/TrailingBackslash/testinvalid.adoc @@ -0,0 +1,11 @@ +//vale-fixture +[source,terminal] +---- +oc get my lunch\ +---- + +//vale-fixture +[source,terminal] +---- +C:\Program Files\ +---- diff --git a/.vale/fixtures/OpenShiftAsciiDoc/TrailingBackslash/testvalid.adoc b/.vale/fixtures/OpenShiftAsciiDoc/TrailingBackslash/testvalid.adoc new file mode 100644 index 00000000..0c456462 --- /dev/null +++ b/.vale/fixtures/OpenShiftAsciiDoc/TrailingBackslash/testvalid.adoc @@ -0,0 +1,46 @@ +[source,terminal] +---- +$ oc get my lunch +---- + +[source,terminal] +---- +# oc get my lunch +---- + +.Example +[source,terminal] +---- +$ az role assignment create --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 "" +---- diff --git a/.vale/styles/OpenShiftAsciiDoc/TrailingBackslash.yml b/.vale/styles/OpenShiftAsciiDoc/TrailingBackslash.yml new file mode 100644 index 00000000..95c87750 --- /dev/null +++ b/.vale/styles/OpenShiftAsciiDoc/TrailingBackslash.yml @@ -0,0 +1,9 @@ +--- +extends: existence +scope: raw +level: error +message: "Unescaped trailing backslash detected in codeblock." +action: + name: remove +raw: + - '(?