Add support for comments in --ignore-words file#2068
Add support for comments in --ignore-words file#2068DimitriPapadopoulos wants to merge 1 commit intocodespell-project:mainfrom
--ignore-words file#2068Conversation
peternewman
left a comment
There was a problem hiding this comment.
So what happens if my typo has a hash in it? Ensuring it's the first character or there's a space before it or something might work, but we really need to update the dictionary tests to ensure they catch this too (so we can't have dictionary entries we can't ignore).
|
Do we intend to catch typos with a hash? Whatever the answer, requiring a space before |
849bf7b to
c679705
Compare
|
I've modified the code to match lines starting with and these would not be comments: My concern is that this is getting quite confusing for end-users, especially those used to Python comments. Instead I would recommend not supporting typos containing hashes. If end-users do ask for this functionality in the future, we could introduce escaping with ' which could be extended to support commas too, as in: By the way, is codespell supposed to support typos with spaces? For example, I know codespell supports $ cd codespell_lib/data
$
$ awk -F '->' '{ print $1; }' *.txt | grep ' '
$ |
I don't specifically know, but if we stop them from being ignored, we ought to stop them getting in the dictionary for now (so we can rethink that issue if any come up).
I think the first of these should be too, i.e. the whole line commented out. I think I'd agree with you on the latter one.
Agreed. It should maybe throw a warning if it matches a non-comment.
Yeah they would be worth considering.
That was mostly the direction I was suggesting you go in, but that does mean the dictionary needs a test so none sneak into there.
Makes sense.
IIRC it doesn't currently (probably because of the correction thing), but a few people have asked for it. |
c679705 to
d4351a0
Compare
|
I've kept the simplest comment definition: comments start with a hash ( While the code itself does not enforce that, I would recommend whitespaces before and after the hash like PEP8: But that's not enforced. In addition to whitespaces and commas, we cannot support hashes in typos any more. Update the dictionary tests accordingly. |
43bd356 to
5bf7863
Compare
5bf7863 to
41cc91c
Compare
41cc91c to
4fb38b0
Compare
4fb38b0 to
e6d90da
Compare
|
Hello, what's up? Recently discovered codespell, like it, but I need to add comment to ignore file to give a note about why we accept one or other misspelling (i.e. |
Like Python comments, comments start with a hash ('#').
This means we cannot support hashes in typos, so check the dictionaries
for hashes.
e6d90da to
ca1188b
Compare
Closes #2063.