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

Request: Spelling check #1628

Closed
strickvl opened this issue Jan 4, 2023 · 6 comments
Closed

Request: Spelling check #1628

strickvl opened this issue Jan 4, 2023 · 6 comments
Labels
plugin Implementing a known but unsupported plugin

Comments

@strickvl
Copy link

strickvl commented Jan 4, 2023

There are seemingly two big Python code checkers: pyspelling and codespell. Codespell doesn't catch everything, and pyspelling is slow to run. It'd be great to have a version / implementation of the logic of these (eventually including PySpelling's exception syntax etc) in ruff.

@colin99d
Copy link
Contributor

colin99d commented Jan 4, 2023

@charliermarsh could we just port over typos, or is it too rust specific?

@charliermarsh
Copy link
Member

I think the best option would be to try and integrate typos as a library (https://docs.rs/typos/0.10.6/typos/). Not sure if the API is amenable to that.

@charliermarsh charliermarsh added the plugin Implementing a known but unsupported plugin label Jan 4, 2023
@charliermarsh
Copy link
Member

(That is: call the typos functions directly in Rust, rather than using the CLI, and report typos as Ruff errors.)

@colin99d
Copy link
Contributor

I have been thinking about this for a while and I think we should keep spell checking separate from Ruff for the following reasons:

  1. This spell checker is already blazingly fast, so users of typos have no reason to switch
  2. Spell checkers do not need to parse python code, so we would not save any additional time from them being part of the library
  3. Having to support multiple languages could be burdensome

@charliermarsh
Copy link
Member

Yeah that makes sense. Let's pass on this for now.

@MicaelJarniac
Copy link
Contributor

I have been thinking about this for a while and I think we should keep spell checking separate from Ruff for the following reasons:

1. This spell checker is already blazingly fast, so users of typos have no reason to switch

2. Spell checkers do not need to parse python code, so we would not save any additional time from them being part of the library

3. Having to support multiple languages could be burdensome

Regarding 2, I think spell checkers can benefit greatly from parsing Python code.

For example, say I've installed a lib from PyPI that has typos on its function names. There's nothing I can do about them, they're outside my control, but I'll need to type the typos if I want to use these functions.

A normal spell checker, that treats everything as plain text, would see the typo and complain about it. But again, there's nothing I can do about them.

If the spell checker understands Python, it'll be able to tell what's my fault and what's outside my control, and so if the typo is on something from an external lib, it can ignore them, as I can't control that, but if the typo is on my own functions and variable names, it can then warn me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin Implementing a known but unsupported plugin
Projects
None yet
Development

No branches or pull requests

4 participants