From 23c085041af09ca6a463209738a904aae8406abc Mon Sep 17 00:00:00 2001 From: Bruno Pimentel Date: Tue, 7 Jan 2025 10:00:52 -0300 Subject: [PATCH] Adds linter for writing style MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .github/workflows/linters.yaml | 21 +++++++++++++++++++ .gitignore | 4 ++++ .vale.ini | 15 +++++++++++++ .../config/vocabularies/konflux/accept.txt | 5 +++++ 4 files changed, 45 insertions(+) create mode 100644 .github/workflows/linters.yaml create mode 100644 .vale.ini create mode 100644 .vale/styles/config/vocabularies/konflux/accept.txt diff --git a/.github/workflows/linters.yaml b/.github/workflows/linters.yaml new file mode 100644 index 00000000..deca9e06 --- /dev/null +++ b/.github/workflows/linters.yaml @@ -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}} diff --git a/.gitignore b/.gitignore index 01813a21..67d0ae97 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,7 @@ public/ # Netlify deploy output from preview workflow deploy.json .DS_Store + +# Vale styles +.vale/styles/* +!.vale/styles/config diff --git a/.vale.ini b/.vale.ini new file mode 100644 index 00000000..ef72286f --- /dev/null +++ b/.vale.ini @@ -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 diff --git a/.vale/styles/config/vocabularies/konflux/accept.txt b/.vale/styles/config/vocabularies/konflux/accept.txt new file mode 100644 index 00000000..797a1e59 --- /dev/null +++ b/.vale/styles/config/vocabularies/konflux/accept.txt @@ -0,0 +1,5 @@ +lockfile +prefetch +Snyk +Konflux +kubectl