-
Notifications
You must be signed in to change notification settings - Fork 610
Bug 5021: Add a script to fix spelling errors with codespell #565
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
Closed
Closed
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
8a9f679
[Bug 5021] Add a script to fix spelling errors with codespell
mrumph bc08d0f
Bug 5021: Improve the spell check script
mrumph acd49d3
fixup: Removed trailing whitespace (detected by Semaphore CI tests)
rousskov 0cf053f
fixup: DRY
rousskov 5523abb
fixup: Do not be verbose by default. The caller can use "sh -x" for that
rousskov 9b3822b
fixup: Group all Perl-related filename masks together
rousskov f44a864
Do process doc/*.txt files by default
rousskov 37649dc
Whitelist tread to work around codespell inability to interpret \t
rousskov 2c18b64
Allow spell-check.sh to be applied to a subset of files
rousskov 94a2043
fixup: Documented usage
rousskov 21a54ee
fixup: Clarified why folks need to stage workspace changes.
rousskov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| actuall | ||
| agains | ||
| aline | ||
| alloced | ||
| anid | ||
| ans | ||
| aparent | ||
| backword | ||
| backwords | ||
| cachable | ||
| cas | ||
| childs | ||
| commend | ||
| crypted | ||
| dont | ||
| fo | ||
| followings | ||
| formater | ||
| hight | ||
| hist | ||
| iff | ||
| inactivate | ||
| initate | ||
| nd | ||
| neeed | ||
| nnumber | ||
| normall | ||
| othere | ||
| pasttime | ||
| performes | ||
| pevents | ||
| pointes | ||
| preceed | ||
| querys | ||
| readed | ||
| referer | ||
| retuned | ||
| sence | ||
| sheme | ||
| tage | ||
| te | ||
| tha | ||
| ther | ||
| therefor | ||
| thru | ||
| thur | ||
| tim | ||
| tread | ||
| tthe | ||
| ue | ||
| uint | ||
| upto | ||
| vaid | ||
| valuse | ||
| whan | ||
| whe | ||
| wil | ||
| wnat |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| #!/bin/sh | ||
| # | ||
| ## Copyright (C) 2020 The Squid Software Foundation and contributors | ||
| ## | ||
| ## Squid software is distributed under GPLv2+ license and includes | ||
| ## contributions from numerous individuals and organizations. | ||
| ## Please see the COPYING and CONTRIBUTORS files for details. | ||
| ## | ||
|
|
||
| # | ||
| # This script uses codespell to automatically fix a subset of common spelling | ||
| # mistakes in the current git-controlled workspace. | ||
| # | ||
| # Usage: ./scripts/spell-check.sh [target]... | ||
| # ... where "target" is a git-controlled file or directory name to be fixed. | ||
| # | ||
| # By default, a hand-picked subset of Squid repository sources is fixed. | ||
| # | ||
| # See ${WHITE_LIST} below for the list of allowed misspellings. | ||
| # | ||
|
|
||
| set -e | ||
|
|
||
| echo -n "Codespell version: " | ||
| if ! codespell --version; then | ||
| echo "This script requires codespell which was not found." | ||
| exit 1 | ||
| fi | ||
|
|
||
| if ! git diff --quiet; then | ||
| echo "There are unstaged changes. This script may modify sources." | ||
| echo "Stage changes to avoid permanent losses when things go bad." | ||
| exit 1 | ||
| fi | ||
|
|
||
| WHITE_LIST=scripts/codespell-whitelist.txt | ||
| if test ! -f "${WHITE_LIST}"; then | ||
rousskov marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| echo "${WHITE_LIST} does not exist" | ||
| exit 1 | ||
| fi | ||
|
|
||
| for FILENAME in `git ls-files "$@"`; do | ||
| # skip subdirectories, git ls-files is recursive | ||
| test -d $FILENAME && continue | ||
|
|
||
| case ${FILENAME} in | ||
|
|
||
| # skip (some) generated files with otherwise-checked extensions | ||
| doc/debug-sections.txt) | ||
| ;; | ||
|
|
||
| # skip imported/foreign files with otherwise-checked extensions | ||
| doc/*/*.txt) | ||
| ;; | ||
|
|
||
| # check all these | ||
| *.h|*.c|*.cc|*.cci|\ | ||
| *.sh|\ | ||
| *.pre|\ | ||
| *.pl|*.pl.in|*.pm|\ | ||
| *.dox|*.html|*.txt|\ | ||
| *.sql|\ | ||
| errors/templates/ERR_*|\ | ||
| INSTALL|README|QUICKSTART) | ||
| if ! codespell -d -q 3 -w -I "${WHITE_LIST}" ${FILENAME}; then | ||
| echo "codespell failed for ${FILENAME}" | ||
| exit 1 | ||
| fi | ||
| ;; | ||
| esac | ||
| done | ||
|
|
||
| exit 0 | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.