Giter Club home page Giter Club logo

Comments (16)

lucasdemarchi avatar lucasdemarchi commented on July 22, 2024 1

@bittorf there isn't a way to do that right now. I think it would be reasonable to add a new option to pass a file with "ignore-words", or to extend the dictionary format to allow passing words as good ones.

For the first option it would be something like:
codespell --ignore-words /path/to/good/dictionary.txt

While for the second we would support in the dictionary a syntax like:
-churchs

So you could use something like thi:
codespell -D - -D /path/to/dictionary/extensions/including/good/words

@anatol @pabs3 @Eric89GXL @thdot thoughts

from codespell.

thdot avatar thdot commented on July 22, 2024 1

I agree with Lucas, adding comments into the code to influence codespell isn't a sustainable way. Personally I like the idea to extend the dictionary syntax, but a word exclude file is fine for me as well.

@bittorf: if you want to ignore just one occurrence of "churchs" I think the --exclude-file option is a good way to achieve that.

from codespell.

peternewman avatar peternewman commented on July 22, 2024 1

I'm not quite sure why this example doesn't follow the pattern:

echo "DotA" | codespell -L DotA -

I get an error that is seemingly inextinguishable.

Try this @alex-zenml :
echo "DotA" | codespell -L dota -

-L WORDS, --ignore-words-list WORDS
comma separated list of words to be ignored by
codespell. Words are case sensitive based on how they
are written in the dictionary file

@bittorf we've also got this now:

  -x FILE, --exclude-file FILE
                        FILE with lines that should not be checked for errors
                        or changed

The issue with comment directives, is e.g. you can't do them within some Pydoc or a Doxygen block or whatever (so it can't always be the line before), and you can then never write codespell ignore= without it ignoring something, i.e. you can't ever write a comment about that behaviour.

from codespell.

thdot avatar thdot commented on July 22, 2024

You could use the --exclude-file option to exclude the lines containing the good word explicitly.
Not the most elegant way, I know.

from codespell.

bittorf avatar bittorf commented on July 22, 2024

a more elegant solution would be a comment-statement in the line with e.g.

codespell: churchs

from codespell.

bittorf avatar bittorf commented on July 22, 2024

@lucasdemarchi that is not the way i like it:

the given example is real ("churchs") but of course i do not want
to loose real occurences of a misspelled "church". think of a large file,
where only 1 thing should be overridden...

from codespell.

lucasdemarchi avatar lucasdemarchi commented on July 22, 2024

from codespell.

bittorf avatar bittorf commented on July 22, 2024

@thdot - i can work with the --exclude-file approach, but it is not elegant. having statements in the file is an old and good way to talk with a compiler. see e.g. GCC or 'shellcheck': https://github.com/koalaman/shellcheck/wiki/Directive

having extra files describing an issue feels like code duplication. what is if a line moves up or down? i have to tweak my 2nd file also...

from codespell.

luzpaz avatar luzpaz commented on July 22, 2024

please integrate a codespell --ignore-words /path/to/good/dictionary.txt

from codespell.

larsoner avatar larsoner commented on July 22, 2024

Fixed by #100

from codespell.

bittorf avatar bittorf commented on July 22, 2024

i still think, that a 'directive' directly above the false positive would be a better solution, e.g.

...
# codespell ignore=churchs
echo "a wrong word: churchs (a shoebrand) and a good word: churches"
...

codespell does not need knowledge about how to detect comments in language XY:
it only must check, if in the line above is a directive "codespell ignore=..."

from codespell.

luzpaz avatar luzpaz commented on July 22, 2024

@bittorf
use the -L flag. Try this:
echo "churchs, churches" | codespell -L churchs -
then try
echo "churchs, churches" | codespell -

from codespell.

bittorf avatar bittorf commented on July 22, 2024

The L flag is not enough:
This way you ignore the wrong word "churchs" in the whole file.

Having a "directive" in the file, you can ignore just a single occurrence
and the knowledge about this special situation is directly at the correct place.

from codespell.

discordianfish avatar discordianfish commented on July 22, 2024

I agree, a directive would be great! I want to be specific about where to ignore what.

from codespell.

alex-zenml avatar alex-zenml commented on July 22, 2024

@bittorf use the -L flag. Try this: echo "churchs, churches" | codespell -L churchs - then try echo "churchs, churches" | codespell -

I'm not quite sure why this example doesn't follow the pattern:

echo "DotA" | codespell -L DotA -

I get an error that is seemingly inextinguishable.

from codespell.

12rambau avatar 12rambau commented on July 22, 2024

just an update that since #2400 it's now possible to add inline ignore comments.

from codespell.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.