Skip to content
This repository has been archived by the owner on Dec 3, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
…culum into smk4664-spellcheck
  • Loading branch information
Mierdin committed May 6, 2020
2 parents 80a959a + 145d10a commit 2579a3d
Show file tree
Hide file tree
Showing 31 changed files with 404 additions and 63 deletions.
257 changes: 257 additions & 0 deletions .aspell.en.pws
Original file line number Diff line number Diff line change
@@ -0,0 +1,257 @@
personal_ws-1.1 en 236
ACL
APIs
ActionChain
ActionChain's
ActionChains
Ansible
Arista
Arista's
BGP
CMDB
ConfigTable
ConfigTables
DateTime
DevOps
Eg
FRR
FactoryLoader
GRPC
GW
Getter
Git's
HCL
Hashicorp
Hostname
hostname
hostnames
html
ICMP
IDL
IFA
IFD
IOS
Idempotency
Init
JSON
JSNAPy
Javascript
Jinja
Junos
JunosDevice
MGMT
MPLS
MQTT
MTU
Mistral
NAPALM's
NRE
NRELabs
NetConf
NetOps
NX
OpTable
OpTables
OperatingSystem
OpenConfig
OpenStack
Orquesta
OSPF
Ok
PFE
PNG
POSIX
Peasy
PyCharm
PyEAPI
PyEZ
PyEZ's
PyEz
QFX
RPC
RPC's
RPCs
RPD
SLAX
SNMP
SSL
STIG
STIGs
StackStorm
StackStorm's
Stackstorm
Sudhishna
TBD
TechLibrary
Terraform
Terraform's
ToDD
Vinayak
VLAN
VLANs
VR
XPath
XSLT
YAML
YAML's
antidotepassword
asynchronously
backend
bgp
boolean
codebase
configs
cURL
cli
cmd
codemirror
com
conf
config
de
declaratively
dev
dict
diff
distro
eAPI
eBGP
echofoo
echos
eg
endpoint
endpoints
env
etree
eventd
exportvar
extensibility
facto
filesize
filesystem
findtext
focussed
foos
fu
getopts
getter
getters
github
greenfield
gRPC
iBGP
ifl
inet
init
influxdb
ing
integrations
intf
io
ip
ipython
jinja
jnpr
jq
jsd
junos
jupyter
jweidley
kernelspec
linux
markdown
mayeates
mimetype
mtu
namespace
nbconvert
nbformat
netconf
nexthop
nonnative
openconfig
parseable
pprint
pre
preinstalled
preloaded
prepopulated
programmability
programmatically
proto
protoc
provisioner
py
pygments
qfx
raylam
readonly
repeatable
repo
rpc
rpc's
runtime
scalable
sh
shahbhoomi
sipphone
situ
sls
snmp
sourcing
squeezy
stackstorm
stdout
stp
str
subcommand
subcommands
subexecutions
substring
switchport
syntaxes
tangentially
teardown
templating
terraform
tf
tmp
toddproject
tradeoffs
txt
undercase
unordered
untracked
uplink
uplinks
uptime
vlans
vpn
vQFX
vqfx
walkthrough
xe
xml
xpath
yaml
yml
reconfiguring
VM
TCP
reachability
instantiation
learnt
login
timestamps
workflow
Workflow
workflows
workflow's
Workflows
API
username
grpc
multi
amongst
voip
timestamp
36 changes: 25 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
language: generic
notifications:
email: false
before_install:
- curl -Lo antidote.tar.gz https://github.com/nre-learning/antidote-core/releases/download/v0.6.0/antidote-linux-amd64.tar.gz && tar xvzf antidote.tar.gz
install:
- ./antidote validate .
- ./check-changelog.sh
sudo: false
after_success:
- ./request-preview.sh
matrix:
include:
- language: generic
notifications:
email: false
addons:
apt:
packages:
- aspell
- aspell-en
- dictionaries-common
script:
- ./check-spelling.sh

- language: generic
notifications:
email: false
before_install:
- curl -Lo antidote.tar.gz https://github.com/nre-learning/antidote-core/releases/download/v0.6.0/antidote-linux-amd64.tar.gz && tar xvzf antidote.tar.gz
install:
- ./antidote validate .
- ./check-changelog.sh
sudo: false
after_success:
- ./request-preview.sh
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## In development

- Add spelling checks in CI pipeline [#276](https://github.com/nre-learning/nrelabs-curriculum/pull/276)

## v1.2.0 - April 14, 2020

Expand Down
69 changes: 69 additions & 0 deletions check-spelling.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/bin/bash
# requires apt packages: aspell, aspell-en

[[ "$TRAVIS_PULL_REQUEST" == "false" ]] && exit 0 # bypass script if not a pull request

RED='\033[0;31m'
GREEN='\033[0;32m'
BLUE='\033[0;36m'
NC='\033[0m' # No Color

FILES_CHANGED=`(git diff --name-only $TRAVIS_COMMIT_RANGE || true) | grep guide.md && (git diff --name-only $TRAVIS_COMMIT_RANGE || true) | grep notebook.ipynb`
# FILES_CHANGED=`git ls-tree -r spellcheck --name-only | grep guide.md && git ls-tree -r spellcheck --name-only | grep notebook.ipynb`

if [ -z "$FILES_CHANGED" ]
then
echo -e "$GREEN>> No markdown file to check $NC"

exit 0;
fi

echo -e "$BLUE>> Following guide or notebook files were changed in this pull request (commit range: $TRAVIS_COMMIT_RANGE):$NC"
echo "$FILES_CHANGED"

TOTAL_NB_MISSPELLED=0
echo -e "$BLUE>> Running spellchecker...$NC"
for FILE in $FILES_CHANGED; do
CONTENTS=`cat $(echo "$FILE" | sed -E ':a;N;$!ba;s/\n/ /g')`
# delete markdown code blocks
CONTENTS=$(echo "$CONTENTS" | sed '/^```/,/^```/d')
# delete html pre blocks
CONTENTS=$(echo "$CONTENTS" | sed '/^<pre>/,/^<\/pre>/d')
# convert markdown inline code to html code
CONTENTS=$(echo "$CONTENTS" | sed -E 's/(^|[^\\`])`([^`]+)`([^`]|$)/\1<code>\2<\/code>\3/g')
# delete html code blocks
CONTENTS=$(echo "$CONTENTS" | sed -r 's/<code>[^<]+<\/code>//g')
# delete html tags
CONTENTS=`echo "$CONTENTS" | sed -E 's/<([^<]+)>//g'`
# delete markdown robot code blocks
CONTENTS=$(echo "$CONTENTS" | sed '/^>```/,/^>```/d')

#echo -e "$BLUE>> Content that will be checked:$NC"
#echo "$CONTENTS"

#echo -e "$BLUE>> Running spellchecker...$NC"
MISSPELLED=`echo "$CONTENTS" | aspell --lang=en --encoding=utf-8 --personal=./.aspell.en.pws list | sort -u`

NB_MISSPELLED=`echo "$MISSPELLED" | wc -w`

if [ "$NB_MISSPELLED" -gt 0 ]
then
TOTAL_NB_MISSPELLED=$((TOTAL_NB_MISSPELLED+NB_MISSPELLED))
# echo -e "$RED>> Words that might be misspelled, please check:$NC"
MISSPELLED=`echo "$MISSPELLED" | sed -E ':a;N;$!ba;s/\n/, /g'`
# echo "$MISSPELLED"
echo -e "\n$RED>> $FILE $NC"
echo -e "$RED>> $NB_MISSPELLED words might be misspelled, please check them:$NC"
echo -e "$MISSPELLED"
fi
done

if [ "$TOTAL_NB_MISSPELLED" -gt 0 ]
then
echo -e "\nTotal Misspelled words: $TOTAL_NB_MISSPELLED"
exit 1
else
COMMENT="No spelling errors, congratulations!"
echo -e "$GREEN>> $COMMENT $NC"
fi
exit 0
4 changes: 2 additions & 2 deletions lessons/bash-introduction/stage1/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export foo
The export command sets the "export" attribute of the variable. This makes 'foo' an *environment variable*. This just means that child processes of the current shell can access these variables. The shell that is created to execute 'echofoo.sh' is a child process. Without the export attribute being set, 'foo' is just a *shell variable.*

---
> **_NOTE:_** Environment variable names should be all uppercase. Shell variables should be all undercase. It is possible to start a variable name with something other than a letter, but don't do that. It's not recommended. In either case, you should use underscores to seperate words in a variable's name.
> **_NOTE:_** Environment variable names should be all uppercase. Shell variables should be all undercase. It is possible to start a variable name with something other than a letter, but don't do that. It's not recommended. In either case, you should use underscores to separate words in a variable's name.
---

Expand All @@ -53,7 +53,7 @@ cat /antidote/stage1/exportvar.sh
```
<button type="button" class="btn btn-primary btn-sm" onclick="runSnippetInTab('linux1', this)">Run this snippet</button>

Ok, so we're going to create 'bar' then call a script to echo it's value back to us. We know this won't work. Then we export 'bar' and call that script again and of course we should now see the value of 'bar' echo'd back.
Ok, so we're going to create 'bar' then call a script to echo it's value back to us. We know this won't work. Then we export 'bar' and call that script again and of course we should now see the value of 'bar' echoed back.

```
/antidote/stage1/exportvar.sh
Expand Down
Loading

0 comments on commit 2579a3d

Please # to comment.