Skip to content

Conversation

@ideaship
Copy link
Contributor

@ideaship ideaship commented Sep 29, 2025

Add the codespell linter which uses a dictionary of common misspellings and ignores unknown words.

This is an updated version of #4143 which was closed as stale and could not be reopened by the maintainer.

Fixes #6255

Proposed Changes

Add the codespell linter which uses a dictionary of common misspellings and ignores unknown words.

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

Note

Integrates the codespell linter across MegaLinter (descriptor, flavors, Docker images, schemas), with tests, docs, and generated metadata updates.

  • New Linter:
    • Add SPELL_CODESPELL (codespell) descriptor with config, examples, and installer in spell.megalinter-descriptor.yml.
    • New standalone image linters/spell_codespell/Dockerfile.
  • Build/Images:
    • Install codespell==2.4.1 and add /venvs/codespell/bin to PATH across root Dockerfile and all flavors (c_cpp, cupcake, documentation, dotnet, dotnetweb, go, java, javascript, php, python, ruby, rust, salesforce, swift, terraform).
  • Configuration/Matrix/Schemas:
    • Include spell_codespell in .automation/generated/linters_matrix.json and versions in .automation/generated/linter-versions.json.
    • Add links/help in .automation/generated/linter-links-previews.json and .automation/generated/linter-helps.json.
    • Add SPELL_CODESPELL to flavors (flavor.json), megalinter/descriptors/all_flavors.json, and JSON Schemas.
    • Disable errors for SPELL_CODESPELL in .mega-linter.yml.
    • Update .cspell.json dictionary with codespell terms.
  • Docs/Changelog:
    • Document standalone image in docs/standalone-linters.md.
    • Add entry to CHANGELOG.md.
  • Tests:
    • Add unit test spell_codespell_test.py and sample files under .automation/test/spell_codespell/.

Written by Cursor Bugbot for commit d16a1ac. This will update automatically on new commits. Configure here.

cursor[bot]

This comment was marked as outdated.

@github-actions
Copy link
Contributor

This pull request has been automatically marked as stale because it has not had recent activity.
It will be closed in 14 days if no further activity occurs.
Thank you for your contributions.

If you think this pull request should stay open, please remove the O: stale 🤖 label or comment on the pull request.

@github-actions github-actions bot added the O: stale 🤖 This issue or pull request is stale, it will be closed if there is no activity label Oct 31, 2025
@github-actions github-actions bot closed this Nov 14, 2025
@nvuillam nvuillam reopened this Nov 14, 2025
@nvuillam nvuillam removed the O: stale 🤖 This issue or pull request is stale, it will be closed if there is no activity label Nov 14, 2025
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@@ -0,0 +1,2 @@
abandonded Dockefile
abberivated acadamy
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Autofix Test File: Misspellings Remain Unfixed

The spell_fix_1.md test file contains the same misspellings as spell_bad_1.md, but should contain the corrected version. Since codespell has cli_lint_fix_arg_name: --write-changes defined, autofix tests expect this file to show the corrected output after applying fixes. It should contain "abandoned Dockerfile\nabbreviated academy" to match the corrections in spell_good_1.md.

Fix in Cursor Fix in Web

@echoix
Copy link
Collaborator

echoix commented Nov 17, 2025

Can the conflicts be solved?

Add the codespell linter which uses a dictionary of common misspellings
and ignores unknown words.

Signed-off-by: Roger Luethi <[email protected]>
- .jsonc
- .json5
- .yaml
- .yml
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Restrictive file extensions prevent checking code

The file_extensions list only includes documentation and data files, preventing codespell from checking source code files (like .py, .js, etc.) as intended by its description and purpose. Consider adding * or a broader list of code extensions to ensure it runs on the codebase.

Fix in Cursor Fix in Web

config_file_name: .codespellrc
cli_config_arg_name: --config
cli_help_arg_name: --help
cli_lint_ignore_arg_name: --skip
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Invalid mapping of ignore file argument

cli_lint_ignore_arg_name is mapped to --skip, which expects a comma-separated list of patterns, but MegaLinter passes the path to the ignore file. This means SPELL_CODESPELL_IGNORE_FILE will not work as expected (it will tell codespell to skip the ignore file itself, not the files listed inside it). Remove this line and rely on .codespellrc for ignores.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add new linter: codespell

3 participants