From 653c086ed02afddbf589ee1fcf4bc782066c4a60 Mon Sep 17 00:00:00 2001 From: Kurt von Laven Date: Fri, 20 Jan 2023 01:55:11 -0800 Subject: [PATCH] Pass extra args for friendlier CSpell UX (#2271) (#2275) Pass --show-context to show the text surrounding a misspelling, --show-suggestions to show best guesses of the correct spelling, and --no-must-find-files to suppress errors when there are no files to spell check. This prevents CSpell from complaining when MegaLinter is run incrementally but no spell-checked files were modified. --- .github/linters/.cspell.json | 1 + CHANGELOG.md | 2 ++ megalinter/linters/CSpellLinter.py | 5 +++++ 3 files changed, 8 insertions(+) diff --git a/.github/linters/.cspell.json b/.github/linters/.cspell.json index 62f3151bd45..0ab257c4c57 100644 --- a/.github/linters/.cspell.json +++ b/.github/linters/.cspell.json @@ -778,6 +778,7 @@ "kxdddddddoc", "lacheck", "langserver", + "Laven", "leavevmode", "leveldb", "levn", diff --git a/CHANGELOG.md b/CHANGELOG.md index c2a1061cde4..3d6a3cbc0f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ Note: Can be used with `oxsecurity/megalinter@beta` in your GitHub Action mega-l - Fixes - Change name of config file for powershell formatter to avoid collision with powershell linter config - Enhance find SARIF json in stdout output + - Pass --show-context, --show-suggestions, and --no-must-find-files to CSpell for friendlier UX + by @Kurt-von-Laven in [#2271](https://github.com/oxsecurity/megalinter/issues/2271). - Documentation - Configure jsonschema documentation formatting (see [Descriptor schema](https://megalinter.io/latest/json-schemas/descriptor.html), [Configuration schema](https://megalinter.io/latest/json-schemas/configuration.html)), by @echoix in [#2270](https://github.com/oxsecurity/megalinter/pull/2270) diff --git a/megalinter/linters/CSpellLinter.py b/megalinter/linters/CSpellLinter.py index 57e2bccfe9d..8e9578fa0d0 100644 --- a/megalinter/linters/CSpellLinter.py +++ b/megalinter/linters/CSpellLinter.py @@ -19,6 +19,11 @@ def __init__(self, params=None, linter_config=None): super().__init__(params, linter_config) def build_lint_command(self, file=None) -> list: + self.cli_lint_extra_args += [ + "--show-context", + "--show-suggestions", + "--no-must-find-files", + ] # Create temp file with files segments if ( self.cli_lint_mode == "list_of_files"