From 975a30560a6899ac8a3c89c0717f80853c9a2b57 Mon Sep 17 00:00:00 2001 From: Avital Pinnick Date: Sun, 14 Jul 2024 18:28:52 +0300 Subject: [PATCH 1/2] Vale --- .github/workflows/lint-with-vale.yml | 21 ++++++++++ .gitignore | 3 ++ .vale.ini | 38 +++++++++++++++++++ .../config/vocabularies/Foreman/accept.txt | 13 +++++++ .../config/vocabularies/Foreman/reject.txt | 7 ++++ guides/common/modules/con_ERROR-TEST.adoc | 7 ++++ 6 files changed, 89 insertions(+) create mode 100644 .github/workflows/lint-with-vale.yml create mode 100644 .vale.ini create mode 100644 .vale/styles/config/vocabularies/Foreman/accept.txt create mode 100644 .vale/styles/config/vocabularies/Foreman/reject.txt create mode 100644 guides/common/modules/con_ERROR-TEST.adoc diff --git a/.github/workflows/lint-with-vale.yml b/.github/workflows/lint-with-vale.yml new file mode 100644 index 00000000000..07ef8e00b40 --- /dev/null +++ b/.github/workflows/lint-with-vale.yml @@ -0,0 +1,21 @@ +--- +name: Linting with Vale on pull request +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: + filter_mode: diff_context + 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}} \ No newline at end of file diff --git a/.gitignore b/.gitignore index d2876debf77..6e70ff8cd4a 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,6 @@ guides/common/default.css /web/.byebug_history /web/output/ /vendor +.vale/* +gl-code-quality-report.json +.vscode/* diff --git a/.vale.ini b/.vale.ini new file mode 100644 index 00000000000..1866198cc06 --- /dev/null +++ b/.vale.ini @@ -0,0 +1,38 @@ +StylesPath = .vale/styles + +MinAlertLevel = suggestion + +IgnoredScopes = code, tt, img, url, a, body.id + +SkippedScopes = script, style, pre, figure, code, tt, blockquote, listingblock, literalblock + +Packages = RedHat, AsciiDoc + +Vocab = Foreman + +# Use local Vocab terms +Vale.Terms = YES +Vale.Avoid = YES + +# Ignore files in dirs starting with `.` to avoid raising errors for `.vale/fixtures/*/testinvalid.adoc` files +[[!.]*.adoc] + +BasedOnStyles = RedHat, AsciiDoc + +# Match INI files. See: https://docs.errata.ai/vale/scoping +[*.ini] + +# Ignore code surrounded by backticks or plus sign, parameters defaults, URLs. +TokenIgnores = (\x60[^\n\x60]+\x60), ([^\n]+=[^\n]*), (\+[^\n]+\+), (http[^\n]+\[), (<[^\n]+>), (URL}[^\n]+\[) + +# Disabling rules (NO) +RedHat.ReleaseNotes = NO + +# Disabling rules (NO) +RedHat.CaseSensitiveTerms = NO +RedHat.ConfigMap = NO +RedHat.Definitions = NO +RedHat.Slash = YES +RedHat.Spacing = NO +RedHat.Spelling = NO +RedHat.TermsSuggestions = NO \ No newline at end of file diff --git a/.vale/styles/config/vocabularies/Foreman/accept.txt b/.vale/styles/config/vocabularies/Foreman/accept.txt new file mode 100644 index 00000000000..20a0654b178 --- /dev/null +++ b/.vale/styles/config/vocabularies/Foreman/accept.txt @@ -0,0 +1,13 @@ +# Regex terms added to accept.txt are ignored by the Vale linter and override RedHat Vale rules. +# Add terms that have a corresponding incorrectly capitalized form to reject.txt. +Katello +[Ss]hellhooks +installer +HAProxy +Product +SSL + +# Terms added until they are fixed in Vale rules +content view +composite content view + diff --git a/.vale/styles/config/vocabularies/Foreman/reject.txt b/.vale/styles/config/vocabularies/Foreman/reject.txt new file mode 100644 index 00000000000..c44db2f9cf9 --- /dev/null +++ b/.vale/styles/config/vocabularies/Foreman/reject.txt @@ -0,0 +1,7 @@ +# Regex terms added to reject.txt are highlighted as errors by the Vale linter and override RedHat Vale rules. +# Add terms that have a corresponding correctly capitalized form to accept.txt. +product + +# Terms added until they are fixed in Vale rules +Content View +Composite Content View diff --git a/guides/common/modules/con_ERROR-TEST.adoc b/guides/common/modules/con_ERROR-TEST.adoc new file mode 100644 index 00000000000..c84859ebbd6 --- /dev/null +++ b/guides/common/modules/con_ERROR-TEST.adoc @@ -0,0 +1,7 @@ +[id="Accessing_Server_{context}"] += Accessing {ProjectName} + +THIS IS A TEST + +Content View +Composite Content View From 2ce46e79745fdb13b2e69d273a1525d89d3cc446 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Thu, 18 Jul 2024 10:41:50 +0200 Subject: [PATCH 2/2] Don't scan common symlinks and use github-pr-annotations We have an excessive symlink farm pointint at guides/common, vale rescans that every time when scanning the individual guides, which makes it super slow (35min on my laptop), excluding the links in guides/doc-* makes it quite fast (90sec on my latop) as it now only scans guides/common once. Also exclicitly use the github-pr-annotations reporter, which works w/o elevated GITHUB_TOKEN privileges and thus also from forked repos. --- .github/workflows/lint-with-vale.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/lint-with-vale.yml b/.github/workflows/lint-with-vale.yml index 07ef8e00b40..e23eb3c128c 100644 --- a/.github/workflows/lint-with-vale.yml +++ b/.github/workflows/lint-with-vale.yml @@ -11,11 +11,9 @@ jobs: - uses: errata-ai/vale-action@reviewdog with: filter_mode: diff_context - vale_flags: "--no-exit --minAlertLevel=error" - reporter: github-pr-review + vale_flags: "--no-exit --minAlertLevel=error --glob=!*/doc-*/common/*" + # github-pr-annotations doesn't require elevated token privileges + reporter: github-pr-annotations 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}} \ No newline at end of file + # let's limit this a bit + files: guides/