Open gaborbernat opened 1 year ago
Similar to #1628
I think my opinion here is mostly the same as it was before: I feel like typo correction is better handled by multi-language or language-agnostic tooling, like typos
, which works on Python but other sources too.
I think that partially makes sense. However, they are some language specific constructs here, for example using snake casing to tokenize the source code, such as variable names or function names. Furthermore, it'll probably is a python specific extension/ allow list of words/ concepts. Finally would be nice if you could set up these tool from pypi like all other linting tools.
Yeah, I think the argument I agree with most here is that it'd be nice to have the spellcheck unified with the rest of the Ruff linting stack (i.e., not a separate tool).
FWIW, typos
does handle casing as you would expect since it is designed to lint "source code":
❯ typos foo.py
error: `helo` should be `hello`
--> foo.py:1:1
|
1 | helo_goodbye = 1
| ^^^^
|
error: `helo` should be `hello`
--> foo.py:2:1
|
2 | heloGoodbye = 1
| ^^^^
|
This would be helpful for those currently leveraging flake8-spellcheck, the last plugin before moving to ruff completely. flake8-spellcheck includes python & django dictionaries. It hasn't been updated for about a year and a half. It would be great to have a python-specific spell checker with the speed of ruff.
https://github.com/MichaelAquilina/flake8-spellcheck/blob/main/flake8_spellcheck/__init__.py
I had no experience with typos
or codespell
yet, but feels like checking source code just like text files may produce a lot of false errors.
So, perhaps good to have an option to check comments and docstrings only, because on code review we reading code much more careful than non-code parts.
👍 or another spellcheck variant 😊