ipfs-cluster / ipfs-cluster-website

The IPFS Cluster website
https://ipfscluster.io
MIT License
42 stars 50 forks source link

Run a spellchecker against the docs as part of your CI #111

Closed peternewman closed 2 years ago

peternewman commented 4 years ago

I'd recommend Codespell: https://github.com/codespell-project/codespell

Steps to run it via CI:

pip install git+https://github.com/codespell-project/codespell.git
SPELLINGBLACKLIST=$(cat <<-BLACKLIST
      -wholename "./.codespellignore" -or \
      -wholename "./.git/*"
BLACKLIST
)
  # run codespell only if it is the requested task
  spellingfiles=$(eval "find ./ -type f -and ! \( \
      $SPELLINGBLACKLIST \
      \) | xargs")
  # count the number of codespell errors
  spellingerrors=$(zrun codespell --check-filenames --check-hidden --quiet 2 --regex "[a-zA-Z0-9][\\-'a-zA-Z0-9]+[a-zA-Z0-9]" --exclude-file .codespellignore -L thead,hsi $spellingfiles 2>&1 | wc -l)
  if [[ $spellingerrors -ne 0 ]]; then
    # print the output for info
    zrun codespell --check-filenames --check-hidden --quiet 2 --regex "[a-zA-Z0-9][\\-'a-zA-Z0-9]+[a-zA-Z0-9]" --exclude-file .codespellignore -L thead,hsi $spellingfiles
    echo "Found $spellingerrors spelling errors via codespell"
    exit 1;
  else
    echo "Found $spellingerrors spelling errors via codespell"
  fi;

I'd have just added it, but I'm more of a Travis than a Circle kind of guy.

hsanjuan commented 2 years ago

this was done.