15
15
# limitations under the License.
16
16
# #########
17
17
# This script verifies mispellings in location. Today it only supports
18
- # verifying English locale but can be modified in a future to support
19
- # also other locales.
18
+ # verifying English locale but can be modified in a future to support
19
+ # other locales also
20
20
# You need to run this script inside the root directory of "website" git repo.
21
- #
21
+ #
22
22
# Syntax: verify-spelling.sh LOCALE
23
23
# Example: verify-spelling.sh en
24
24
# If no locale is passed, it will assume "en"
25
- #
25
+ #
26
26
# Requirements:
27
27
# - go v1.14 or superior version
28
28
@@ -34,6 +34,8 @@ set -o pipefail
34
34
35
35
TOOL_VERSION=" v0.3.4"
36
36
37
+ KUBE_ROOT=$( dirname " ${BASH_SOURCE[0]} " ) /..
38
+
37
39
LANGUAGE=" ${1:- en} "
38
40
# cd to the root path
39
41
ROOT=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) /.." && pwd -P) "
@@ -60,10 +62,15 @@ cd "${ROOT}"
60
62
RES=0
61
63
echo " Checking spelling..."
62
64
ERROR_LOG=" ${TMP_DIR} /errors.log"
63
- git ls-files | grep content/${LANGUAGE} | xargs misspell > " ${ERROR_LOG} "
65
+
66
+ # NOTE we usually don't correct old blog articles, so we ignore them in
67
+ # this file.
68
+ skipping_file=" ${KUBE_ROOT} /scripts/.spelling_failures"
69
+ failing_packages=$( sed " s| | -e |g" " ${skipping_file} " )
70
+ git ls-files -z | grep --null-data " ^content/${LANGUAGE} " | grep --null-data -v -e " ${failing_packages} " | xargs -0 -r misspell > " ${ERROR_LOG} "
64
71
if [[ -s " ${ERROR_LOG} " ]]; then
65
72
sed ' s/^/error: /' " ${ERROR_LOG} " # add 'error' to each line to highlight in e2e status
66
- echo " Found spelling errors!"
73
+ echo " Found spelling errors!" >&2
67
74
RES=1
68
75
fi
69
76
exit " ${RES} "
0 commit comments