Skip to content

Commit

Permalink
feat(doc): add valeCLI github action to automatically lint extension …
Browse files Browse the repository at this point in the history
…documentation.
  • Loading branch information
lmartella1 committed Jun 13, 2024
1 parent ce3d8a5 commit 1d0306a
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/.vale.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Vale configuration file.
# For more information, see: https://vale.sh/docs/topics/config.

# The relative path to the folder containing linting rules (styles).
StylesPath = .github/styles

# Minimum alert level
# -------------------
# The minimum alert level in the output (suggestion, warning, or error).
# If integrated into CI, builds fail by default on error-level alerts, unless you run Vale with the --no-exit flag
MinAlertLevel = warning

# IgnoredScopes specifies inline-level HTML tags to ignore.
# These tags may occur in an active scope (unlike SkippedScopes, skipped entirely) but their content still will not raise any alerts.
# Default: ignore `code` and `tt`.
IgnoredScopes = code, tt, img, url, a, body.id

# SkippedScopes specifies block-level HTML tags to ignore. Ignore any content in these scopes.
# Default: ignore `script`, `style`, `pre`, and `figure`.
SkippedScopes = script, style, pre, figure, code, tt, blockquote, listingblock, literalblock

Vocab = quarkus-kafka-streams-definitions

Packages = RedHat, AsciiDoc

[*.adoc]
BasedOnStyles = Custom, RedHat, AsciiDoc

# Ignore code matching the following patterns:
# (\x60[^\n\x60]+\x60) - code surrounded by backticks - e.g. `BatchApplication`
# (:[^\n]+: [^\n]+) - attributes definitions - e.g. `:param: value`
# ([^\n]+=[^\n]*) - config definitions - e.g. param=value
# (https?:\/\/[^\n\s]+) - URLs - e.g. https://www.example.com
# (\b\w+_\w+\b) - snake case words - e.g. batch_application
# (\b\w+_\w+\b) - kebab case words - e.g. batch-application
# (\{[^\}]+\}\S+\[) - URLs based on attribute - e.g. {url}/path[link]
# (^\.\w+\.\w+$) - callouts title - e.g. .pom.xml
TokenIgnores = (\x60[^\n\x60]+\x60), (:[^\n]+: [^\n]+), ([^\n]+=[^\n]*), (https?:\/\/[^\n\s]+), (\b\w+_\w+\b), (\b\w+-\w+\b), (\{[^\}]+\}\S+\[), (^\.\w+\.\w+$)

# Disable the execution of this style as all our callouts are using include::[] directive
AsciiDoc.MatchingNumberedCallouts = NO
7 changes: 7 additions & 0 deletions .github/styles/Custom/HeadingNestingDepth.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
extends: existence
message: 'The subheading "%s" is nested too deeply. The max heading nesting depth is set to 3.'
level: error
scope: raw
raw:
- '(?<=\n)={4,}\s.+'
9 changes: 9 additions & 0 deletions .github/styles/Custom/SingleStatementPerLine.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
extends: occurrence
message: Only use one sentence per line.
level: error
scope:
- paragraph
- list
max: 1
token: '(?<!Inc|e\.g|etc|i\.e|vs)[.!?](?: |$)'
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
DLQ
JSON
kubernetes
NFRs
openshift
opentelemetry
POJO[?s]
Protobuf
Quarkus
Splunk
XML
YAML
21 changes: 21 additions & 0 deletions .github/workflows/lint-with-vale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: lint-with-vale.yml
on: [pull_request]

jobs:
vale:
name: Linting with Vale
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: errata-ai/vale-action@reviewdog
with:
files: docs/ROOT/pages/
filter_mode: added
vale_flags: "--no-exit --minAlertLevel=error"
reporter: github-pr-review
fail_on_error: true
env:
# Required, set by GitHub actions automatically:
# https://docs.github.com/en/actions/security-guides/automatic-token-authentication#about-the-github_token-secret
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
REVIEWDOG_GITHUB_API_TOKEN: ${{secrets.GITHUB_TOKEN}}
9 changes: 9 additions & 0 deletions docs/modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,15 @@ The selection is done through a blacklist of method signatures gathered in a pri
Is showcased here also the injection of another bean to be used in this decorator.
<6> Example of decorated method, here the main `punctuate` method of the `Punctuator` interface.

==== A new too much nestad section

This is a new section that is too much nested. It should raise several Vale errors as the nesting is too deep and/or there isn`t a sigle line per stetament.

Normally the word NFRs should raise a spelling issue but it won't as we have added it in the `accept.txt` file.

You may delete this section once you have tested the vale intgration.


[[extension-configuration-reference]]
== Extension configuration reference

Expand Down

0 comments on commit 1d0306a

Please sign in to comment.