I'd rather have any script just "use misspell if installed". Downloading and running a binary on developer's machine is usually not what I'd expect a test script to do.
So what you are suggesting is that I should add an option to check for the typos errors, and whenever it is called it should checks if misspell is installed, if it is we should use to detect the mistakes and if not it will give the user instructions if they want to install it?
Thanks for this patch. I missed it because this ticket was in the wrong component.
(And using @teor doesn't work - you need to add "teor" to the CC field.)
Code review:
The makefile should check for misspell at runtime, not configure time. Otherwise, a user who reads your message and installs misspell will get very confused. Try the shell command called "command". Or look how it's done elsewhere in the makefile.
Also, markdown links don't work in most terminals. You are better to just link once at the end of the log message:
misspell(http://github.com/client9/misspell)
Trac: Keywords: N/Adeleted, tor-comment added Component: Community to Core Tor/Tor Milestone: N/Ato Tor: 0.3.4.x-final Points: N/Ato 0.5 Status: new to needs_revision
LGTM and works fine in my testing. I rebased it to master but there are still a few typos around the codebase, should we fix them as part of this ticket?
Also what's make check-local and is it used by anything? If it's used by something I dont want it to burp because of the warnings about misspell missing.
Please see branch ticket25024 in my github repo (https://github.com/asn-d6/tor), which includes fristonio's patch, rebased to latest master, with some word changes to make it obvious that misspell is an optional feature.
I rebased to master so that it includes #23650 (moved) patch. However I noticed that there are still a few typos in the codebase. I started fixing them but then I noticed that some of them are not actually typos but are either spanish words, or partial-words because of the way C strings are formatted. e.g.:
config_line_append(&labels, "Adios", "planetas");./src/test/test_conscache.c:44:40: "planetas" is a misspelling of "planets" memcpy(ext_or_auth_cookie, "s beside you? When I count, ther", 32);./src/test/test_extorport.c:246:58: "ther" is a misspelling of "there"
What should we do about these cases? We could use misspell's -i switch to ignore those corrections, but does this scale? We could disallow spanish words or partial words but that would be too authoritarian...
I'm gonna mark this as needs_revision until we find a solution to the above, since IMO it doesn't make sense to have a spellchecker that will always complain about non-issues.
I completely agree with your point here asn, this will be an issue if we add misspell to Tor. Also, the -i flag solution does not seem to be scalable at all.
One possible solution I see here for this is to have some ignore rules feature in misspell something like what eslint have for JS wherein we can specify with the help of comments if we want to ignore a block of code from being checked.
See here: [https://eslint.org/docs/user-guide/configuring#disabling-rules-with-inline-comments]
What is your thought on this?
But as of now misspell does not have this feature. I will talk to the maintainer regarding this feature. Maybe I will send a PR myself for the same to the project if required. Till then we can keep the patch on hold.
I completely agree with your point here asn, this will be an issue if we add misspell to Tor. Also, the -i flag solution does not seem to be scalable at all.
One possible solution I see here for this is to have some ignore rules feature in misspell something like what eslint have for JS wherein we can specify with the help of comments if we want to ignore a block of code from being checked.
See here: [https://eslint.org/docs/user-guide/configuring#disabling-rules-with-inline-comments]
What is your thought on this?
I feel like that might be a bit too ugly for our codebase just for a spellcheck. Perhaps that's fine for tests tho. IMO all possible solutions are a bit ugly here:
a) Inline comments to disable spellcheck
b) Custom dictionary
c) Custom ignore rules with -i.
I think we should decide how this feature should be used tho. If people are supposed to run this before every commit then it should have zero false positives. However, if that's just something that the maintainer runs before every stable release every few months, then perhaps some false positives are fine (or they can be removed with a custom dictionary).
In general, I don't have strong opinions here, and as long as this feature is optional as it is, perhaps we can just merge it as is. What do you think?
I too don't have any strong opinion about this, as the above mentioned point seems quite valid. Maybe someone more experienced with Tor will have a better say here. :)
OK. I think I'll merge_ready this. No reason to just hold this off until we find the perfect solution which obviously does not exist.
If Nick likes the idea too, let's get it merged, see how and if it gets used, see if the false-positives are problematic, and iterate on this with the various approaches from comment:22 . No reason to spend too much time rabitholing about this ticket.
Fixes look like they are addressing Nick's comments.
I feel like + $(top_srcdir)/src/[^e]*/*.[ch] \ is kind of a inelegant way to exclude src/ext/ but I don't know a better way to do it apart from using find or something, and right now it should work OK. If this feature ends up being useful, and we ever add another directory in src/ that starts with e we can think of a better approach there.
Setting this to merge_ready so that Nick can inspect it again.