Skip to content

Commit

Permalink
Merge pull request #874 from aireilly/vale-gitlab-report
Browse files Browse the repository at this point in the history
Updating docs for Gitlab CI options
  • Loading branch information
aireilly authored Aug 27, 2024
2 parents 4b48941 + 4da3e0c commit dd9dadf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 4 additions & 4 deletions modules/user-guide/examples/gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ code_quality:
- apk update && apk add git
- vale sync # Pull down VRH rules package specified in vale.ini
script:
# Get complete list of *.adoc files in the repo
- FILES=$(find . -type f -name "*.adoc")
# Clean out conditions for wider vale coverage
- sed -i -e 's/ifdef::.*\|ifndef::.*\|ifeval::.*\|endif::.*/ /' ${FILES}
# Get complete list of *.adoc files in the repository
- FILES=$(find . -type f -name "*.adoc") # <1>
# Clean out conditions for wider Vale coverage in AsciiDoc
- sed -i -e 's/ifdef::.*\|ifndef::.*\|ifeval::.*\|endif::.*/ /' ${FILES} # <2>
# Use a template to rearrange the vale JSON output
# Run vale with --no-exit to pass the build with errors
- vale ${FILES} --minAlertLevel=error --glob='*.adoc' --output="$(pwd)/vale-json.tmpl" > gl-code-quality-report.json
Expand Down
5 changes: 5 additions & 0 deletions modules/user-guide/pages/gitlab-code-quality-reports.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ The widget reports style compliance issues in the GitLab merge request interface
----
include::example$gitlab-ci.yml[]
----
<1> Update the `$FILES` step to match your documentation source type, for example, use `*.md` for markdown.
<2> Optional.
Vale does not lint inside AsciiDoc conditional statements unless you pass the conditional variables as link:https://vale.sh/docs/topics/scoping/#asciidoc[Asciidoctor attributes].
You can bypass this limitation in the CI by temporarily removing `ifdef` and `ifeval` directives before linting with Vale.
This step is only useful for AsciiDoc, and can be removed for other source formats.

. Create a `vale-json.tmpl` file at the repository root:
+
Expand Down

0 comments on commit dd9dadf

Please sign in to comment.