Skip to content

Commit fc32918

Browse files
authored
Add the check-spelling.sh script (#23)
This script checks spelling in `gravitational/docs`. Add this script to `gravitational/docs-website` to ensure parity in our docs CI workflow.
1 parent 0174662 commit fc32918

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

scripts/check-spelling.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# $1 is the content directory in which to check spelling. A content directory is
2+
# a git submodule pointing to a branch of the gravitational/teleport repository.
3+
4+
if [ $# -eq 0 ]; then
5+
6+
cat<<EOF
7+
8+
You must provide an argument to the spellcheck script. The argument must be the
9+
path to a content directory, which is either:
10+
11+
- A subdirectory of "content" within a gravitational/docs clone
12+
- The root of a gravitational/teleport clone
13+
14+
EOF
15+
exit 1;
16+
fi
17+
18+
if [ ! -e $1/docs/cspell.json ]; then
19+
20+
cat<<EOF
21+
22+
We could not find $1/docs/cspell.json. Make sure you run the spellcheck script
23+
on either:
24+
25+
- A subdirectory of "content" within a gravitational/docs clone
26+
- The root of a gravitational/teleport clone
27+
28+
EOF
29+
exit 1;
30+
fi
31+
32+
npx cspell lint --no-progress --config $1/docs/cspell.json "$1/docs/pages/**/*.mdx" "$1/CHANGELOG.md";
33+
RES=$?;
34+
if [ $RES -ne 0 ]; then
35+
cat<<EOF
36+
37+
There are spelling issues in one or more pages within $1/docs/pages (see the
38+
logs above). Either fix the misspellings or, if these are not actually issues,
39+
edit the list of ignored words in $1/docs/cspell.json.
40+
41+
EOF
42+
exit $RES;
43+
fi
44+

0 commit comments

Comments
 (0)