Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass extra args for friendlier CSpell UX (#2271) #2275

Merged
merged 1 commit into from
Jan 20, 2023
Merged

Pass extra args for friendlier CSpell UX (#2271) #2275

merged 1 commit into from
Jan 20, 2023

Conversation

Kurt-von-Laven
Copy link
Collaborator

Fixes #2271.

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.

Proposed Changes

  1. Append --show-context, --show-suggestions, and --no-must-find-files to cli_lint_extra_args.

Readiness Checklist

Author/Contributor

  • Add entry to the CHANGELOG listing the change and linking to the corresponding issue (if appropriate)
  • If documentation is needed for this change, has that been included in this pull request

Reviewing Maintainer

  • Label as breaking if this is a large fundamental change
  • Label as either automation, bug, documentation, enhancement, infrastructure, or performance

@Kurt-von-Laven Kurt-von-Laven added the bug Something isn't working label Jan 18, 2023
@Kurt-von-Laven Kurt-von-Laven self-assigned this Jan 18, 2023
@nvuillam
Copy link
Member

nvuillam commented Jan 18, 2023

🦙 MegaLinter status: ⚠️ WARNING

Descriptor Linter Files Fixed Errors Elapsed time
✅ BASH bash-exec 7 0 0.02s
✅ BASH shellcheck 7 0 0.5s
✅ BASH shfmt 7 0 0 0.39s
✅ COPYPASTE jscpd yes no 3.18s
✅ DOCKERFILE hadolint 105 0 10.61s
✅ JSON eslint-plugin-jsonc 21 0 0 2.45s
✅ JSON jsonlint 19 0 0.26s
✅ JSON v8r 21 0 14.6s
⚠️ MARKDOWN markdownlint 305 0 229 7.73s
✅ MARKDOWN markdown-link-check 305 0 6.54s
✅ MARKDOWN markdown-table-formatter 305 0 0 21.93s
✅ OPENAPI spectral 1 0 1.09s
⚠️ PYTHON bandit 176 45 2.72s
✅ PYTHON black 176 0 0 5.96s
✅ PYTHON flake8 176 0 2.16s
✅ PYTHON isort 176 0 0 0.84s
✅ PYTHON mypy 176 0 8.04s
✅ PYTHON pylint 176 0 14.21s
⚠️ PYTHON pyright 176 282 21.23s
✅ REPOSITORY checkov yes no 31.63s
✅ REPOSITORY git_diff yes no 0.39s
✅ REPOSITORY secretlint yes no 9.47s
✅ REPOSITORY trivy yes no 28.91s
✅ SPELL cspell 726 0 23.2s
✅ SPELL misspell 547 0 0 1.05s
✅ XML xmllint 3 0 0 0.38s
✅ YAML prettier 81 0 0 3.39s
✅ YAML v8r 23 0 65.56s
✅ YAML yamllint 82 0 1.76s

See detailed report in MegaLinter reports

MegaLinter is graciously provided by OX Security

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.
@nvuillam
Copy link
Member

nvuillam commented Jan 18, 2023

🦙 MegaLinter status: ⚠️ WARNING

Descriptor Linter Files Fixed Errors Elapsed time
✅ BASH bash-exec 7 0 0.02s
✅ BASH shellcheck 7 0 0.38s
✅ BASH shfmt 7 0 0 0.03s
✅ COPYPASTE jscpd yes no 2.14s
✅ DOCKERFILE hadolint 105 0 7.66s
✅ JSON eslint-plugin-jsonc 21 0 0 1.73s
✅ JSON jsonlint 19 0 0.2s
✅ JSON npm-package-json-lint yes no 0.51s
✅ JSON v8r 21 0 14.7s
⚠️ MARKDOWN markdownlint 305 2 229 5.99s
✅ MARKDOWN markdown-link-check 305 0 5.16s
✅ MARKDOWN markdown-table-formatter 305 2 0 13.89s
✅ OPENAPI spectral 1 0 0.78s
⚠️ PYTHON bandit 176 45 3.34s
✅ PYTHON black 176 0 0 3.67s
✅ PYTHON flake8 176 0 3.57s
✅ PYTHON isort 176 0 0 0.41s
✅ PYTHON mypy 176 0 7.01s
✅ PYTHON pylint 176 0 11.35s
⚠️ PYTHON pyright 176 280 17.13s
✅ REPOSITORY checkov yes no 26.25s
⚠️ REPOSITORY devskim yes 61 1.34s
✅ REPOSITORY dustilock yes no 1.8s
✅ REPOSITORY git_diff yes no 0.04s
✅ REPOSITORY secretlint yes no 4.25s
✅ REPOSITORY syft yes no 3.26s
✅ REPOSITORY trivy yes no 18.73s
✅ SPELL cspell 726 0 17.85s
✅ SPELL misspell 547 2 0 0.46s
✅ XML xmllint 3 0 0 0.03s
✅ YAML prettier 81 0 0 2.37s
✅ YAML v8r 23 0 52.33s
✅ YAML yamllint 82 0 1.44s

See detailed report in MegaLinter reports

You could have same capabilities but better runtime performances if you request a new MegaLinter flavor.

MegaLinter is graciously provided by OX Security

@nvuillam
Copy link
Member

@Kurt-von-Laven just in case, will the new output still be compliant with custom behaviour of CSpell linter ? ( especially the part that generates an updated .cspell.json file in reports)

https://github.com/oxsecurity/megalinter/blob/main/megalinter/linters/CSpellLinter.py

@Kurt-von-Laven
Copy link
Collaborator Author

Great question. Yes, I tested that it still works by running CSpell via npx with and without the new flags and copying the output into https://regex101.com. It's possible to break that regular expression even before this PR by deliberately crafting malicious filenames, but it's very unlikely that it would occur by accident. It doesn't seem necessary to make the regular expression fancier unless we receive user feedback demonstrating a real-world issue since the added complexity would likely make the regex more brittle to changes in CSpell's output format.

@nvuillam
Copy link
Member

Ok, we'll check that with beta version on MegaLinter own repo before releasing next version :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CSpell Complains When No Spell-Checked Files Were Modified
2 participants