-
Notifications
You must be signed in to change notification settings - Fork 542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug 5021: Add a script to fix spelling errors with codespell #565
Conversation
Run "scripts/spell-check.sh" from the Squid tree root directory. For details, see bug report 5021: - https://bugs.squid-cache.org/show_bug.cgi?id=5021 Changes to be committed: new file: scripts/codespell-whitelist.txt new file: scripts/spell-check.sh (cherry picked from commit 0678534)
Can one of the admins verify this patch? |
This pull request is related to pull request #562. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for posting this! I only have a couple of minor questions and suggestions for now. Please see inlined change requests for details. I will come back after reviewing the results of applying this script (that you have already posted elsewhere).
I looked through the actual spelling changes (2c7a572) and was surprised to see no truly bad ones. Either codespell is just terrific at avoiding problematic areas or @mrumph did an excellent job whitelisting them! I had one minor question at https://github.com/squid-cache/squid/pull/562/files#r388061762 but that wrinkle can be ignored if needed. I also plan to run the script myself. If there are no red flags there, and after this script-focused PR is cleaned up, I would be happy to support merging this PR, committing the script results (in another dedicated PRs), and automating these checks. |
Addressed comments from the pull request squid-cache#565. Changes to be committed: modified: scripts/spell-check.sh
Status update: I have resolved the change requests that I consider fully addressed by bc08d0f. Thank you! I need a bit more time to finalize two or three outstanding issues and test the script. I may have a chance to do that this weekend. |
I am getting the following error when testing the current PR with codespell v1.14.0 on Ubuntu 19.04:
The important (but invisible) part here is that the problematic source code file does not have a word The core of the problem could be related to codespell-project/codespell#1422 but I am not sure. |
doc/HTTP-codes.txt has a spelling error. Still exclude doc/debug-sections.txt because it is generated. Still exclude doc/*/*.txt because they are imported/foreign.
Status update: I made a few adjustments and have resolved all the outstanding change requests. I also started to test the script and found one issue that we will have to resolve, one way or another, before this PR is merged. I requested more information in hope to be able to suggest the best way forward. @mrumph, please check my recent changes (up to branch commit f44a864) to make sure that you more-or-less agree with them and that I did not miss anything important. If you are learning git: |
For the dictionary entry "tread ==> tread, thread", I didn't see a hit on this, but there were a few other words that I added to the white list because of being preceded by "\n" or "\t". |
All of the commits by Rousskov look good to me. |
What does your |
My codespell version is 1.16.0, but this replaced an earlier 1.8 version. |
I could not find any more cases where \x was misinterpreted (for any x).
This is very useful when working on a small subset of files because spell checking the whole tree takes a while: git diff $base --name-only | xargs ./scripts/spell-check.sh
Done at 37649dc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK to test |
@yadij, do we want to include the script (and its whitelist file) in the "make dist" tarball? If yes, we will need to adjust scripts/Makefile.am before this PR goes in. I am guessing that the spellchecking script should not be included because we do not include scripts/source-maintenance.sh, but you know better. Also, if you want this script to be called from scripts/source-maintenance.sh, please say so. I think it should eventually be called from there (because it is a part of source code maintenance), but I do not know whether adding it now is a good idea (because it may affect your packaging scripts). |
So using "$@" will limit the list of files to a specific list of directories. |
Sorry. The $@ can only be used as a list of directories if it is not quoted. |
FTR: criteria for that answer is whether the test/check is verifying or altering how the end-user code builds and operates. From what I have seen so far this is just internal textual changes, so no we only need the script itself in the repo. The tarballs get its output.
We will need to arrange its call like the astyle one either way - ensuring that we only have a manually verified tool version used. So the build machines do not fight over trivial version output differences. If that is done before this gets merged it should be fine adding now. |
What makes you think that? Please double check. In my tests, quoted sh -x ./scripts/spell-check.sh "src " 'doc' 2>&1 | less
Your example above does not use the Even if I am right, we can still remove quoting because Squid sources do not use filenames with special characters. Please let me know if you insist on that removal, and I will do it. |
@yadij, thank you for sharing your insights! Subject to @mrumph blessing, I plan to clear this PR after documenting anonymous parameters per @mrumph request.
I hope we can avoid running this new script (and, long term, running |
The script cannot, technically, create "conflicts" (at least not in a git sense of that word). The script might wipe out or corrupt unstaged changes, and we want to protect users from that. A very useful side effect of our protection is that any script changes are very easy to _review_ using `git diff --word-diff`. Any developer ought to review codespell changes. The script itself is probably not the right place to document/discuss all that.
Agreed. Done in 94a2043. Please review that commit and 21a54ee that polishes error output. @mrumph, with these changes, I am waiting for your blessing to clear this PR for merging OR your request for more adjustments (e.g., unquoting |
"Please double check. In my tests, quoted $@ works exactly the way one would want it to work -- quoting individual parameters rather than the whole parameter list -- it is some kind of shell magic. First of all, I don't "insist" on anything. I am only trying to help the project. |
Sorry, I did not mean to imply anything negative: As the primary author, you have a well-deserved right to pick one of the several options approved by the reviewer. I did not want to impose (technically optional) quoting if you happen to dislike it for some reason, especially since I am not a shell scripting expert...
Glad we are on the same page! I am clearing the PR for merging. Other reviewers may block it at the last minute, but I still want to thank you for investing so much into this valuable improvement. I especially appreciate your prompt reaction to my questions and changes. |
Running scripts/spell-check.sh from the Squid source tree root directory should fix many spelling errors in a subset of git-controlled files. This commit excludes the spelling fixes themselves.
Running scripts/spell-check.sh from the Squid source tree root directory
should fix many spelling errors in a subset of git-controlled files.
This commit excludes the spelling fixes themselves.