Skip to content

Commit

Permalink
Pass extra args for friendlier CSpell UX (#2271)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Kurt-von-Laven committed Jan 18, 2023
1 parent 8b00741 commit aba7ccc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/linters/.cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,7 @@
"kxdddddddoc",
"lacheck",
"langserver",
"Laven",
"leavevmode",
"leveldb",
"levn",
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions megalinter/linters/CSpellLinter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit aba7ccc

Please sign in to comment.