streetsidesoftware / cspell-dicts

Various cspell dictionaries
Other
223 stars 207 forks source link

Why is "setuptools" flagged as an error? #1507

Closed mwarres closed 2 years ago

mwarres commented 2 years ago

Upon removing "setuptools" from the custom dictionary, CSpell gives a false positive with the error /tmp/lint/poetry.toml:6:4 - Unknown word (setuptools); see ScribeMD/.github#85. Interestingly, the same PR works (i.e., there is no false-positive) here: ScribeMD/docker-cache#177.

I tested removing the css dictionary from .github's CSpell config file so that its CSpell config file would match that found in docker-cache; however, removing setuptools from the custom dictionary still resulted in a false-positive.

Thank you for taking a look at this!

nschonni commented 2 years ago

You're running cSpell indirectly through megalinter, which packages it's own versions of various tools. You should open the issue on that repo

mwarres commented 2 years ago

I just tested that hypothesis by running npx cspell "**" on my local branch for https://github.com/ScribeMD/.github/pull/85. I still got the following error: Unknown word (setuptools). Thus, I believe this is an issue with CSpell, not MegaLinter.

nschonni commented 2 years ago

Ah, running cspell trace setuptools show's its in the python-common dictionary rather than the python dictionary. Might not be loading the detault dictionary because the poetry.toml isn't parsed as a Python file by default https://github.com/streetsidesoftware/cspell-dicts/blob/53608ae88dbd90315be546ce45439134c25e7c5b/dictionaries/python/cspell.json#L3

mwarres commented 2 years ago

Neither ScribeMD/docker-cache nor ScribeMD/.github have the python-common dictionary, so I'm puzzled why the behavior is inconsistent between repos. When I run npx cspell trace setuptools in docker-cache, I get:

Word       F Dictionary           Dictionary Location           
setuptools - [flagWords]*         From Settings `flagWords`
setuptools - [ignoreWords]*       From Settings `ignoreWords`
setuptools - [words]*             From Settings `words`
setuptools - ada                  ../../../.npm/_npx/b338be1...@cspell/dict-ada/ada.txt.gz
setuptools - aws*                 ../../../.npm/_npx/b338be1...@cspell/dict-aws/aws.txt.gz
setuptools - backwards-compatibi* ../../../.npm/_npx/b338be1.../compatibility-words.txt.gz
setuptools - bash                 ../../../.npm/_npx/b338be1...dict-bash/bash-words.txt.gz
setuptools - companies*           ../../../.npm/_npx/b338be1...-companies/companies.txt.gz
setuptools - cpp                  ../../../.npm/_npx/b338be1...@cspell/dict-cpp/cpp.txt.gz
setuptools - cpp-refined          ../../../.npm/_npx/b338be1...dict-cpp/cpp-refined.txt.gz
setuptools - cryptocurrencies*    ../../../.npm/_npx/b338be1...ies/cryptocurrencies.txt.gz
setuptools - csharp               ../../../.npm/_npx/b338be1...l/dict-csharp/csharp.txt.gz
setuptools - css                  ../../../.npm/_npx/b338be1...@cspell/dict-css/css.txt.gz
setuptools - custom*              .dictionary.txt
setuptools - dart                 ../../../.npm/_npx/b338be1...spell/dict-dart/dart.txt.gz
setuptools - django               ../../../.npm/_npx/b338be1...l/dict-django/django.txt.gz
setuptools - docker               ../../../.npm/_npx/b338be1...-docker/docker-words.txt.gz
setuptools - dotnet               ../../../.npm/_npx/b338be1...l/dict-dotnet/dotnet.txt.gz
setuptools - elixir               ../../../.npm/_npx/b338be1...l/dict-elixir/elixir.txt.gz
setuptools - en_us*               ../../../.npm/_npx/b338be1...ll/dict-en_us/en_US.trie.gz
setuptools - en-gb                ../../../.npm/_npx/b338be1...ll/dict-en-gb/en_GB.trie.gz
setuptools - filetypes*           ../../../.npm/_npx/b338be1...-filetypes/filetypes.txt.gz
setuptools - fonts                ../../../.npm/_npx/b338be1...ell/dict-fonts/fonts.txt.gz
setuptools - fullstack*           ../../../.npm/_npx/b338be1...-fullstack/fullstack.txt.gz
setuptools - golang               ../../../.npm/_npx/b338be1...spell/dict-golang/go.txt.gz
setuptools - haskell              ../../../.npm/_npx/b338be1...dict-haskell/haskell.txt.gz
setuptools - html                 ../../../.npm/_npx/b338be1...spell/dict-html/html.txt.gz
setuptools - html-symbol-entitie  ../../../.npm/_npx/b338be1...ol-entities/entities.txt.gz
setuptools - java                 ../../../.npm/_npx/b338be1...spell/dict-java/java.txt.gz
setuptools - latex                ../../../.npm/_npx/b338be1...ell/dict-latex/latex.txt.gz
setuptools - lorem-ipsum          ../../../.npm/_npx/b338be1...rem-ipsum/dictionary.txt.gz
setuptools - lua                  ../../../.npm/_npx/b338be1...@cspell/dict-lua/lua.txt.gz
setuptools - networking-terms     ../../../.npm/_npx/b338be1...erms/networkingTerms.txt.gz
setuptools - node                 ../../../.npm/_npx/b338be1...spell/dict-node/node.txt.gz
setuptools - npm*                 ../../../.npm/_npx/b338be1...@cspell/dict-npm/npm.txt.gz
setuptools - php                  ../../../.npm/_npx/b338be1...@cspell/dict-php/php.txt.gz
setuptools - powershell           ../../../.npm/_npx/b338be1...owershell/powershell.txt.gz
setuptools - public-licenses*     ../../../.npm/_npx/b338be1...nses/public-licenses.txt.gz
setuptools - python*              ../../../.npm/_npx/b338be1...l/dict-python/python.txt.gz
setuptools * python-common        ../../../.npm/_npx/b338be1...python/python-common.txt.gz
setuptools - r                    ../../../.npm/_npx/b338be1...les/@cspell/dict-r/r.txt.gz
setuptools - ruby                 ../../../.npm/_npx/b338be1...spell/dict-ruby/ruby.txt.gz
setuptools - rust                 ../../../.npm/_npx/b338be1...spell/dict-rust/rust.txt.gz
setuptools - scala                ../../../.npm/_npx/b338be1...ell/dict-scala/scala.txt.gz
setuptools - softwareTerms*       ../../../.npm/_npx/b338be1...-terms/softwareTerms.txt.gz
setuptools - sql                  ../../../.npm/_npx/b338be1...@cspell/dict-sql/sql.txt.gz
setuptools - swift                ../../../.npm/_npx/b338be1...ell/dict-swift/swift.txt.gz
setuptools - typescript           ../../../.npm/_npx/b338be1...ypescript/typescript.txt.gz

indicating, as you pointed out, that setuptools is not found in the python dictionary. So, then, I believe CSpell's failure to output an error in docker-cache is a false-negative. Could this have something to do with compound words?

Jason3S commented 2 years ago

@mwarres,

I don't think this is a CSpell issue.

image

Looks like the Mega Linter was not run in your PR: ScribeMD/docker-cache#177

mwarres commented 2 years ago

MegaLinter was indeed run in ScribeMD/docker-cache#177; we run it through pre-commit hooks. But upon further investigation, it does seem that this is an issue (oxsecurity/megalinter#1942) with MegaLinter's interaction with pre-commit, not CSpell. Thanks for your help in the meantime!

Jason3S commented 2 years ago

@mwarres,

Thank makes sense if it only checks files that change, but don't take into account that it might impact other files.

mwarres commented 2 years ago

Just for clarification in case anyone else reads this thread in the future and this is pertinent to their troubleshooting: we did run the checks on all files via poetry run pre-commit run --all-files --hook-stage push and still got the false-negative for setuptools. I suspect the issue is related to quoting within the context of interactions between pre-commit and MegaLinter.