drahnr / cargo-spellcheck

Checks all your documentation for spelling and grammar mistakes with hunspell and a nlprule based checker for grammar
Apache License 2.0
314 stars 32 forks source link

How to ignore files #290

Open hanabi1224 opened 1 year ago

hanabi1224 commented 1 year ago

Q:

What are the CLI options or config fiels that I can use to ignore some .rs files, e.g. those auto-generated by protobuf, thanks!

drahnr commented 1 year ago

Generally, generated files should be put under OUT_DIR, which is excluded in .gitignore which is honoured. If you include files as part of your source tree, imho formatting makes sense. Assuming this is output of your build.rs, adding another line formatting it should work.

Would this be feasible or do you have a different use case?

hanabi1224 commented 1 year ago

Generally, generated files should be put under OUT_DIR

One counter-example is rust-libp2p is moving its protobuf generated files to source tree so that it won't require protoc to compile.

imho formatting makes sense.

It's not a formatting issue, but it has invalid words in its comments that are caught by cargo-spellcheck.

What I would like to have is sth like cargo-spellcheck --ignore [glob] --ignore [glob], just like cargo audit

Let me know if my explanations make sense

drahnr commented 1 year ago

It does make sense.

What do you think about a regex in the config file which could be part of the repository?

hanabi1224 commented 1 year ago

Either way is good for me. Thanks for accepting this feature request!

btw, IMHO glob patterns would be better and easier than regular expressions

jmintb commented 1 year ago

Just bumping this, I have a CSS files with classes that I cannot change which would be nice to ignore.

jmintb commented 1 year ago

Happy to work on this if you think it makes sense for a first time contributor.

jmintb commented 1 year ago

Just bumping this, I have a CSS files with classes that I cannot change which would be nice to ignore.

Sorry I forgot that cargo-spell check is for documentation and comments, it was another tool complaining about the css,