From d5fb187ade1d8ac1a7af8139c738645b3e10de08 Mon Sep 17 00:00:00 2001 From: "kirill.chalov" Date: Fri, 21 Mar 2025 15:27:06 +0800 Subject: [PATCH 1/5] feat: add vale configuration and Espressif-devportal style --- .vale.ini | 127 +++++++++++++ .../HeadingSentenceCase.yml | 168 ++++++++++++++++++ .../ListEndPunctuation.yml | 19 ++ .../Espressif-devportal/ListMixedType.yml | 12 ++ .../Espressif-devportal/NonStandardChars.yml | 11 ++ .../Espressif-devportal/OfxordComma.yml | 8 + .../Espressif-devportal/TermsAcronyms.yml | 142 +++++++++++++++ .../Espressif-devportal/TermsFixedPattern.yml | 11 ++ .../TermsSingleCorrectSpelling.yml | 32 ++++ .../Espressif-devportal/UsefulLinkText.yml | 19 ++ 10 files changed, 549 insertions(+) create mode 100644 .vale.ini create mode 100644 .vale/styles/Espressif-devportal/HeadingSentenceCase.yml create mode 100644 .vale/styles/Espressif-devportal/ListEndPunctuation.yml create mode 100644 .vale/styles/Espressif-devportal/ListMixedType.yml create mode 100644 .vale/styles/Espressif-devportal/NonStandardChars.yml create mode 100644 .vale/styles/Espressif-devportal/OfxordComma.yml create mode 100644 .vale/styles/Espressif-devportal/TermsAcronyms.yml create mode 100644 .vale/styles/Espressif-devportal/TermsFixedPattern.yml create mode 100644 .vale/styles/Espressif-devportal/TermsSingleCorrectSpelling.yml create mode 100644 .vale/styles/Espressif-devportal/UsefulLinkText.yml diff --git a/.vale.ini b/.vale.ini new file mode 100644 index 000000000..7b1766614 --- /dev/null +++ b/.vale.ini @@ -0,0 +1,127 @@ +################### +### 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, Espressif-devportal + + +### Deactivate individual rules ### +### in enabled styles. +# Style1.Rule1 = NO +Vale.Repetition = NO +Vale.Spelling = NO +Espressif-latest.Admonitions = NO +Espressif-latest.Adverbs = NO +Espressif-latest.Contractions = NO +Espressif-latest.HeadingBegin = NO +Espressif-latest.HeadingEnd = NO +Espressif-latest.Headings = NO +Espressif-latest.Monospace = NO +Espressif-latest.PascalCamelCase = NO +Espressif-latest.TermsAcronyms = NO +Espressif-latest.TermsFixedPattern = NO +Espressif-latest.TermsSingleCorrectSpelling = 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 diff --git a/.vale/styles/Espressif-devportal/HeadingSentenceCase.yml b/.vale/styles/Espressif-devportal/HeadingSentenceCase.yml new file mode 100644 index 000000000..ac4681252 --- /dev/null +++ b/.vale/styles/Espressif-devportal/HeadingSentenceCase.yml @@ -0,0 +1,168 @@ +--- +extends: capitalization +level: suggestion +link: https://redhat-documentation.github.io/vale-at-red-hat/docs/main/reference-guide/headings/ +match: $sentence +message: "Use sentence-style capitalization. Found: '%s'. Suggested: '%s'. Ensure that proper nouns and noun phrases are capitalized correctly." +scope: heading +indicators: + - ":" +exceptions: + +# Espressif + - Espressif + - Xtensa + - RISC-V + - Wokwi + - 'Developer Portal' + - DevKit + - SoCs? + - (?i)VSCode + - (?i)FreeRTOS + - eFuses? + - \bESP[-A-Za-z0-9_]*\b + - Rainmaker + - LowCode + - ZeroCode + +# Embedded + - ADC + - AIoT + - DAC + - IoT + - Matter + - PHY + - PSRAM + - RAM + - SRAM + - WLED + +# Rust + - 'Rust' + - 'std' + - 'no_std' + +# Measurement Units + - kbps|Mbps|Gbps + - KiB|MiB|GiB + - kHz|MHz|GHz + - dBm|dBu|dBV + +# General + - Ansible + - Antora + - API + - AppData + - AsciiDoc + - Asciidoctor + - AWS + - Azure + - BASIC + - Bitbucket + - BOM + - Bugzilla + - CDs + - CentOS + - Ceph + - CLI + - Clion + - CMake + - Copilot + - DdoS + - DevOps + - DevOps + - DNS + - DNSSec + - Docker + - Dockerfiles? + - Eclipse + - Flatpak + - Flatpak Builder + - GCC + - Git + - GitHub + - GitLab + - GitOps + - GraphQL + - GUI + - Homebrew + - HTTP + - HTTPS + - IaaS + - IBM + - ID + - IDEs? + - IDs + - IntelliJ + - IPSec + - JAR file + - Java + - JavaScript + - JetBrains + - Jira + - JSON + - Kubernetes + - LibreOffice + - Linux + - LLVM + - Lua + - MAC + - macOS + - Makefile + - Mattermost + - MicroPython + - Microsoft + - MinGW + - MongoDB + - MySQL + - NetworkManager + - Nginx + - Node.js + - NuttX + - NVMe + - OAuth + - OpenJDK + - OpenOCD + - OpenShift + - OpenSSH + - OpenSSL + - OpenStack + - OpenTelemetry + - OpenTracing + - PCIe + - PHP + - Podman + - POSIX + - PostgreSQL + - PostScript + - PowerShell + - Prometheus + - Python + - Pytorch + - Qt + - Qute + - Red Hat + - Redis + - RTOS + - SaaS + - SDK + - SELinux + - Studio + - SVG + - SysV + - Traefik + - TypeScript + - URI + - URIs? + - URLs? + - USB + - Vale + - Vmware + - VS + - VS Code + - WebSocket + - Windows + - WireGuard + - Wordpress + - xterm + - YouTube diff --git a/.vale/styles/Espressif-devportal/ListEndPunctuation.yml b/.vale/styles/Espressif-devportal/ListEndPunctuation.yml new file mode 100644 index 000000000..6e1589fc4 --- /dev/null +++ b/.vale/styles/Espressif-devportal/ListEndPunctuation.yml @@ -0,0 +1,19 @@ +extends: existence +message: "Ensure consistent punctuation in lists. Some items end with punctuation while others don't." +level: warning +link: https://mos.espressif.com/punctuation.html#punctuation-in-lists +scope: raw +nonword: true +tokens: + # Find bulleted lists with inconsistent punctuation + - '(?m)^[\-\+\*]\s.*\w(? Define Abbreviations and Acronyms at First Use +link: http://mos.espressif.com/general-conventions.html#define-abbreviations-and-acronyms-at-first-use +level: warning +# Ensures that the existence of 'first' implies the existence of 'second'. +first: '(?`_ + - '(?<=`)(?:\b(?:in|on|at)\s+)?(here|click here|this page|this link|read more|learn more)(?= <[^>]+>`_)' + # Check rST internal refs :ref:`here` + - '(?<=:ref:`)(?:\b(?:in|on|at)\s+)?(here|click here|this page|this link|read more|learn more)(?=<[^`>]+>`)' From 035745c31f839e8c444ae90132135ed45da0b883 Mon Sep 17 00:00:00 2001 From: "kirill.chalov" Date: Fri, 21 Mar 2025 15:29:38 +0800 Subject: [PATCH 2/5] ci: add workflow to lint PR diffs using vale --- .github/workflows/pr-lint-vale.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .github/workflows/pr-lint-vale.yml diff --git a/.github/workflows/pr-lint-vale.yml b/.github/workflows/pr-lint-vale.yml new file mode 100644 index 000000000..12f14d356 --- /dev/null +++ b/.github/workflows/pr-lint-vale.yml @@ -0,0 +1,13 @@ +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 + with: + reporter: github-pr-check + fail_on_error: true From d92c6bcacd555668f0a49423234305289b452dce Mon Sep 17 00:00:00 2001 From: "kirill.chalov" Date: Fri, 21 Mar 2025 17:19:57 +0800 Subject: [PATCH 3/5] test: add errors to test vale config --- README.md | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/README.md b/README.md index 58933b479..87158b3d5 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,9 @@ This project stores the files for the [Espressif Developer Portal][] website. Gi [Espressif Developer Portal]: https://developer.espressif.com/ +This doesn't works. See [this](./content/blog/2025/03/esp32-bluetooth-clearing-the-air/index.md#impat). + +For details, see the page [at this link](https://google.com). ## Contribute and render locally @@ -17,3 +20,66 @@ See also the Contribution Guide articles: - [Contribution workflow](./content/pages/contribution-guide/contrib-workflow/index.md) - [Writing content](./content/pages/contribution-guide/writing-content/index.md) + +## Test Vale style + +--- + +Rule `Espressif-devportal.HeadingSentenceCase` + +#### Use Sentence Style Capitalization + +#### Exceptions for capitalization can be added like espressif + +--- + +Rules `Espressif-devportal.ListEndPunctuation` and `Espressif-devportal.ListMixedType` + +Simple bullet list: + +- Item 1 +- Item 2. + +Multi-level list: + +1. Item 1: +2. Item 2 + - Item 1. + - Item 2 + +Bullets and numbers at the same level: + +1. Item 1 +- Item 2 + +--- + +Rule `Espressif-devportal.NonStandardChars` + +The modules–those that integrate SoCs–are more popular. + +--- + +Rule `Espressif-devportal.OfxordComma` + +Espressif is famous for its SoCs, modules and development boards. + +--- + +Rule `Espressif-devportal.TermsAcronyms` + +LP-Core integrates an IMAC CPU. + +--- + +Rules `Espressif-devportal.TermsFixedPattern` and `Espressif-devportal.TermsSingleCorrectSpelling` + +Espressif SOCs are famous for its Wi-Fi and bluetooth features. ESP-iDF programming guide is also popular. + +--- + +Rule `Espressif-devportal.UsefulLinkText` + +For details, see [here](https://google.com) and [on this page][example]. + +[example]: https://google.com From 7966dfe8dbde98c253c9226710f8c0e43703dfcf Mon Sep 17 00:00:00 2001 From: "kirill.chalov" Date: Fri, 28 Mar 2025 19:35:48 +0800 Subject: [PATCH 4/5] chore: remove error in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 87158b3d5..b613a2415 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ Rule `Espressif-devportal.HeadingSentenceCase` #### Use Sentence Style Capitalization -#### Exceptions for capitalization can be added like espressif +#### Exceptions for capitalization can be added like Espressif --- From 2960685b87ab19e706514758a9c18a8dc78a6870 Mon Sep 17 00:00:00 2001 From: "kirill.chalov" Date: Fri, 28 Mar 2025 19:47:12 +0800 Subject: [PATCH 5/5] ci: update workflow --- .github/workflows/pr-lint-vale.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr-lint-vale.yml b/.github/workflows/pr-lint-vale.yml index 12f14d356..4293f29a2 100644 --- a/.github/workflows/pr-lint-vale.yml +++ b/.github/workflows/pr-lint-vale.yml @@ -10,4 +10,5 @@ jobs: - uses: errata-ai/vale-action@v2.1.1 with: reporter: github-pr-check + vale_flags: "--minAlertLevel=suggestion" fail_on_error: true