3 ## Copyright (C) 1996-2023 The Squid Software Foundation and contributors
5 ## Squid software is distributed under GPLv2+ license and includes
6 ## contributions from numerous individuals and organizations.
7 ## Please see the COPYING and CONTRIBUTORS files for details.
11 # This script uses codespell to automatically fix a subset of common spelling
12 # mistakes in the current git-controlled workspace.
14 # Usage: ./scripts/spell-check.sh [target]...
15 # ... where "target" is a git-controlled file or directory name to be fixed.
17 # By default, a hand-picked subset of Squid repository sources is fixed.
19 # See ${ALLOW_LIST} below for the list of allowed misspellings.
24 printf "Codespell version: "
25 if ! codespell
--version; then
26 echo "This script requires codespell which was not found."
30 if ! git
diff --quiet; then
31 echo "There are unstaged changes. This script may modify sources."
32 echo "Stage changes to avoid permanent losses when things go bad."
36 IGNORE_LIST
=scripts
/codespell-ignorelist.txt
37 if test ! -f "${IGNORE_LIST}"; then
38 echo "${IGNORE_LIST} does not exist"
42 for FILENAME
in `git ls-files "$@"`; do
43 # skip subdirectories, git ls-files is recursive
44 test -d $FILENAME && continue
48 # skip (some) generated files with otherwise-checked extensions
49 doc
/debug-sections.txt
)
52 # skip imported/foreign files with otherwise-checked extensions
61 *.dox|
*.html|
*.md|
*.txt|\
63 errors
/templates
/ERR_
*|\
64 INSTALL|README|QUICKSTART
)
65 if ! codespell
-d -q 3 -w -I "${IGNORE_LIST}" ${FILENAME}; then
66 echo "codespell failed for ${FILENAME}"