Skip to content

Commit

Permalink
Add the check-spelling.sh script (#23)
Browse files Browse the repository at this point in the history
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
ptgott authored Nov 5, 2024
1 parent 0174662 commit fc32918
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions scripts/check-spelling.sh
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

0 comments on commit fc32918

Please sign in to comment.