Skip to content

Commit

Permalink
Adds linter for writing style
Browse files Browse the repository at this point in the history
This patch introduces Vale¹ as a writing style linter, and configures it
using Red Hat's styles².

It also sets up a corresponding Github Action to run Vale during the CI.
If any of the lines introduced by the PR causes an error level linting
message, the CI will fail.

¹https://vale.sh/docs
²https://redhat-documentation.github.io/vale-at-red-hat/docs/main/user-guide/introduction/

Signed-off-by: Bruno Pimentel <[email protected]>
  • Loading branch information
brunoapimentel committed Jan 13, 2025
1 parent 730a792 commit 23c0850
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/linters.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Linters
on:
- pull_request
jobs:
vale:
name: vale
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Asciidoctor
run: sudo apt-get install -y asciidoctor
- name: Vale Linter
uses: errata-ai/vale-action@reviewdog
with:
vale_flags: "--minAlertLevel=error"
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}}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,7 @@ public/
# Netlify deploy output from preview workflow
deploy.json
.DS_Store

# Vale styles
.vale/styles/*
!.vale/styles/config
15 changes: 15 additions & 0 deletions .vale.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
StylesPath = .vale/styles

MinAlertLevel = warning

IgnoredScopes = code, tt, img, url, a, body.id

SkippedScopes = script, style, pre, figure, code, tt, blockquote, listingblock, literalblock

Packages = RedHat

Vocab = konflux

[*.adoc]

BasedOnStyles = RedHat
5 changes: 5 additions & 0 deletions .vale/styles/config/vocabularies/konflux/accept.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
lockfile
prefetch
Snyk
Konflux
kubectl

0 comments on commit 23c0850

Please sign in to comment.