From 84bf98e65c1515174f936b3e7d0a5ddf0feb1a48 Mon Sep 17 00:00:00 2001 From: "kirill.chalov" Date: Mon, 17 Mar 2025 19:43:50 +0800 Subject: [PATCH 1/3] feat: add vale config and github workflow --- .github/workflows/pr-vale-lint.yml | 10 +++ .vale.ini | 119 +++++++++++++++++++++++++++++ 2 files changed, 129 insertions(+) create mode 100644 .github/workflows/pr-vale-lint.yml create mode 100644 .vale.ini diff --git a/.github/workflows/pr-vale-lint.yml b/.github/workflows/pr-vale-lint.yml new file mode 100644 index 000000000..499cf6798 --- /dev/null +++ b/.github/workflows/pr-vale-lint.yml @@ -0,0 +1,10 @@ +name: reviewdog +on: [pull_request] + +jobs: + vale: + name: runner / vale + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: errata-ai/vale-action@v2.1.1 diff --git a/.vale.ini b/.vale.ini new file mode 100644 index 000000000..51864dc02 --- /dev/null +++ b/.vale.ini @@ -0,0 +1,119 @@ +################### +### Vale Config ### +################### + +# This is a Vale linter configuration file. +# - Repo: esp-vale-config (Default config) +# - Version: v0-1-1 +# It lists all necessary parameters to configure Vale for your project. +# For official documentation on all config settings, see +# https://vale.sh/docs/topics/config + + +############## +### Global ### +############## + +# This section lists core settings applying to Vale itself. + + +# Specify path to external resources (e.g., styles and vocab files). +# The path value may be absolute or relative to this configuration file. +StylesPath = .vale/styles + + +# Specify the minimum alert severity that Vale will report. +MinAlertLevel = suggestion # "suggestion", "warning", or "error" + + +# Specify vocabulary for special treatment. +# Create a folder in /Vocab//and add its name here +# The folder should contain two files: +# - accept.txt -- lists words with accepted case-sensitive spelling +# - reject.txt -- lists words whose occurrences throw an error +# Vocab = Espressif + + +# Specify the packages to import into your project. +# A package is a zip file containing a number of rules (style) written in YAML. +# For a list of official packages, see Package Hub at https://vale.sh/hub/ +# For official documentation on packages, see +# https://vale.sh/docs/topics/packages/ +# Before linting, navigate to your project and run `vale sync` to download +# the official packages specified below. +# Packages = Package1, Package2, \ +# https://example.com/path/to/package/Package.zip +Packages = Google, Microsoft, RedHat, \ +https://dl.espressif.com/dl/esp-vale-config/Espressif-latest.zip + + +############### +### Formats ### +############### + +# This section enables association of "unknown" formats with the ones +# supported by Vale. For official documentation on supported formats, see +# https://vale.sh/docs/topics/scoping/ +[formats] + +# For example, treat MDX files as Markdown files. +# mdx = md + + +################################ +### Format-specific settings ### +################################ + +# This section lists the settings that apply to specific file formats +# based on their glob pattern. +# Settings provided under a more specific glob pattern, +# such as [*.{md,txt}] will override those in [*]. +[*.{md,rst}] + + +# Enable styles to activate all rules included in them. +# BasedOnStyles = Style1, Style2 +BasedOnStyles = Vale, Espressif-latest + + +### Deactivate individual rules ### +### in enabled styles. +# Style1.Rule1 = NO +Vale.Repetition = NO +Vale.Spelling = NO +Espressif-latest.Admonitions = NO +Espressif-latest.Contractions = NO +Espressif-latest.Monospace = NO + + +### Change default severity level ### +### of an activated rule. +# Choose between "suggestion", "warning", or "error". +# Style1.Rule2 = error + + +### Activate individual rules ### +### in non-enabled styles stored in . +# Style1.Rule = YES +Google.Gender = YES +Google.GenderBias = YES +Google.Slang = YES +Google.Spacing = YES +Microsoft.DateNumbers = YES +Microsoft.Ellipses = YES +Microsoft.FirstPerson = YES +Microsoft.Hyphens = YES +Microsoft.Ordinal = YES +Microsoft.OxfordComma = YES +Microsoft.Percentages = YES +#Microsoft.Quotes = YES +Microsoft.RangeTime = YES +Microsoft.Semicolon = YES +Microsoft.SentenceLength = YES +Microsoft.Suspended = YES +Microsoft.Units = YES +Microsoft.URLFormat = YES +Microsoft.We = YES +Microsoft.Wordiness = YES +RedHat.Contractions = YES +RedHat.RepeatedWords = YES From 138c5585da8994d1351d5fc04ab2f21e64e83ad6 Mon Sep 17 00:00:00 2001 From: "kirill.chalov" Date: Mon, 17 Mar 2025 19:56:25 +0800 Subject: [PATCH 2/3] test: add content for testing --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 58933b479..7a685c56e 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ This project stores the files for the [Espressif Developer Portal][] website. Gi [Espressif Developer Portal]: https://developer.espressif.com/ +Here is a sentence to test Vale: wi-fi, SOCs. ## Contribute and render locally From dbf0859166219e44c7efb2ddce4f68e01b6adb7b Mon Sep 17 00:00:00 2001 From: "kirill.chalov" Date: Mon, 17 Mar 2025 20:05:27 +0800 Subject: [PATCH 3/3] feat: update reporter type --- .github/workflows/pr-vale-lint.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-vale-lint.yml b/.github/workflows/pr-vale-lint.yml index 499cf6798..aabdf3313 100644 --- a/.github/workflows/pr-vale-lint.yml +++ b/.github/workflows/pr-vale-lint.yml @@ -7,4 +7,20 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: errata-ai/vale-action@v2.1.1 + + - uses: reviewdog/action-setup@v1 + with: + reviewdog_version: latest + + - name: Install Vale + run: | + curl -fsSL https://github.com/errata-ai/vale/releases/latest/download/vale-linux-amd64 --output /usr/local/bin/vale + chmod +x /usr/local/bin/vale + vale --version # Check installation + + - name: Run Vale and pass output to Reviewdog + env: + REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + vale . 2>&1 | reviewdog -efm="%f:%l:%c: %m" \ + -name="Vale" -reporter=github-pr-review -filter-mode=diff_context -level=warning