-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,44 @@ | ||
# $1 is the content directory in which to check spelling. A content directory is | ||
# a git submodule pointing to a branch of the gravitational/teleport repository. | ||
|
||
if [ $# -eq 0 ]; then | ||
|
||
cat<<EOF | ||
You must provide an argument to the spellcheck script. The argument must be the | ||
path to a content directory, which is either: | ||
- A subdirectory of "content" within a gravitational/docs clone | ||
- The root of a gravitational/teleport clone | ||
EOF | ||
exit 1; | ||
fi | ||
|
||
if [ ! -e $1/docs/cspell.json ]; then | ||
|
||
cat<<EOF | ||
We could not find $1/docs/cspell.json. Make sure you run the spellcheck script | ||
on either: | ||
- A subdirectory of "content" within a gravitational/docs clone | ||
- The root of a gravitational/teleport clone | ||
EOF | ||
exit 1; | ||
fi | ||
|
||
npx cspell lint --no-progress --config $1/docs/cspell.json "$1/docs/pages/**/*.mdx" "$1/CHANGELOG.md"; | ||
RES=$?; | ||
if [ $RES -ne 0 ]; then | ||
cat<<EOF | ||
There are spelling issues in one or more pages within $1/docs/pages (see the | ||
logs above). Either fix the misspellings or, if these are not actually issues, | ||
edit the list of ignored words in $1/docs/cspell.json. | ||
EOF | ||
exit $RES; | ||
fi | ||
|