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

misspell: support multiple correction words #4834

Conversation

alexandear
Copy link
Member

@alexandear alexandear commented Jun 21, 2024

Allows to have multiple corrections.

extra-words.correction can accept either a single word or a list of words separated by commas:

linters-settings:
  misspell:
    extra-words:
      - typo: "iff"
        correction: "if"
      - typo: "successed"
        correction: "successful,success,succeeded"

When a misspelling is detected, the following lint message is displayed:

`successed` is a misspelling of `successful,success,succeeded`

However, during the fix process, only the first word in the list of corrections is used: "successed" is replaced with "successful".

The feature was requested in Slack discussion.

@ldez ldez self-requested a review June 21, 2024 11:46
@ldez ldez added the declined label Jun 21, 2024
@ldez
Copy link
Member

ldez commented Jun 21, 2024

I declined this PR because misspell is made to match one word with another.

The fact of picking the first one proves that this is not adapted.

I can see several problems:

  • it's a niche
  • misspell was not designed for that

misspell is not a real typo detector, it's more an opiniated linter based on a set of known typos.
A known typo is a tuple of one misspelled word and one correction.
Because it's a misspelled word, the correction is also known.

@ldez ldez closed this Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants