Skip to content

Commit

Permalink
feat(ci): adds grammar and spell checking for code/content tests (#701)
Browse files Browse the repository at this point in the history
closes #694

Currently spell checking runs on code and content `wget` from STG. This
feature needs to be further built out to run in workflow automation.
Creating #700 for this.
  • Loading branch information
dgrebb authored Sep 27, 2023
1 parent 4974e1a commit 954a021
Show file tree
Hide file tree
Showing 7 changed files with 3,312 additions and 0 deletions.
24 changes: 24 additions & 0 deletions _ci/spell/.gramma.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"api_url": "https://api.languagetool.org/v2/check",
"api_key": "",
"dictionary": [],
"language": "en-US",
"rules": {
"casing": true,
"colloquialisms": true,
"compounding": true,
"confused_words": true,
"false_friends": true,
"gender_neutrality": true,
"grammar": true,
"misc": true,
"punctuation": true,
"redundancy": true,
"regionalisms": true,
"repetitions": true,
"semantics": true,
"style": true,
"typography": true,
"typos": true
}
}
11 changes: 11 additions & 0 deletions _ci/spell/content.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# Checks final build spelling

SITEMAP="${1:-https://stg.dgrebb.com/sitemap.xml}"
urls=$(curl -s $SITEMAP | grep "<loc>" | awk -F"<loc>" '{print $2} ' | awk -F"</loc>" '{print $1}')
for url in $urls; do
echo "$url"
content=$(wget $url -q -O - | npm run text -- -p machine --selectors[] {} :selector=img :format=skip)
echo $content | npm run spell -- stdin://$url
done
10 changes: 10 additions & 0 deletions _ci/spell/cspell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"dictionaryDefinitions": [
{
"name": "dgWords",
"path": "./dict.txt",
"addWords": true
}
],
"dictionaries": ["dgWords"]
}
46 changes: 46 additions & 0 deletions _ci/spell/dict.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
dgrebb
subdir
strapi
cmsdomain
FARGATE
jsonencode
awsvpc
awslogs
regexall
fqdns
basedomain
reportsdomain
cdndomain
etag
filemd
wonka
notfound
navbrand
blistre
psxl
psbl
Csvg
Crect
subactive
pubdate
extralight
hljs
doctag
themeset
pinboard
Grebb
beareth
fullname
obtaineth
pageviews
ohhhhh
ongoingly
Strapi
Commeth
developeth
shineth
Speaketh
runneth
navigateth
provideth
Ensureth
31 changes: 31 additions & 0 deletions _ci/spell/list.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
bluebg="\e[44m"
green="32"
red="31"
yellow="33"
BR="\e[${red}m"
BG="\e[1;${green}m"
BY="\e[1;${yellow}m"
NC="\033[0m" # No Color

# Checks final build spelling

SITEMAP="${1:-https://stg.dgrebb.com/sitemap.xml}"
urls=$(curl -s $SITEMAP | grep "<loc>" | awk -F"<loc>" '{print $2} ' | awk -F"</loc>" '{print $1}')
for url in $urls; do
echo
echo "=================================================="
echo
echo "📖 Reading $url..."
content=$(wget $url -q -O - | npm run text -- -p human --selectors[] {} :selector=img :format=skip) >/dev/null
spelling=$(echo $content | npm run -s spell.web.list -- stdin://$url --quiet)
grammar=$(echo "$content" | npm run grammar)
echo
# sp=$(printf "${BG}✓ All spelling correct!${NC}")
# if [[ $spelling ]]; then sp=$(printf "${BY}%s\n\n${NC}${BR}%s${NC}" "Spelling errors found!" "$spelling"); fi
# echo -e "$sp"
# gr=$(printf "${BG}✓ All grammar correct!${NC}")
# if [[ $grammar ]]; then sp=$(printf "${BY}%s\n\n${NC}${BR}%s${NC}" "Grammar issues found!" "$grammar"); fi
# echo -e "$gr"
echo $grammar
done
Loading

0 comments on commit 954a021

Please sign in to comment.