Skip to content

TypoCI/spellcheck-action

Repository files navigation

Typo CI Logo - It's a sword surrounded by brackets

Typo CI - Spellcheck Action

Checks for spelling mistakes within code via a GitHub Action

RSpec passing

👉 If you'd like to use this Action without having to add any files to your repository, consider the Typo CI GitHub App 👈

Installation

Copy add the following to .github/workflows/spellcheck.yml:

# Add to: .github/workflows/spellcheck.yml
name: Typo CI

on:
  push:
    branches-ignore:
      - master
jobs:
  spellcheck:
    name: Typo CI (GitHub Action)
    runs-on: ubuntu-latest
    timeout-minutes: 4
    if: "!contains(github.event.head_commit.message, '[ci skip]')"
    steps:
    - name: TypoCheck
      uses: typoci/spellcheck-action@master
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Configuration

You can tweak how Typo CI analyses your code by adding a .typo-ci.yml file to the root of your repository (You can also add it within your .github folder). Here is a sample file:

# This is a sample .typo-ci.yml file, it's used to configure how Typo CI will behave.
# Add it to the root of your project and push it to github.
---

# What language dictionaries should it use? By default Typo CI will select 'en' & 'en_GB'
# Currently Typo CI supports:
# de
# en
# en_GB
# es
# fr
# it
# nl
# pt
# pt_BR
# tr
dictionaries:
  - en
  - en_GB

# Any files/folders we should ignore?
excluded_files:
  - "vendor/**/*"
  - "node_modules/**/*"
  - "*.key"
  - "*.enc"
  - "*.min.css"
  - "*.css.map"
  - "*.min.js"
  - "*.js.map"
  - "*.mk"
  - "package-lock.json"
  - "yarn.lock"
  - "Gemfile.lock"
  - ".typo-ci.yml"
  - ".github/.typo-ci.yml"

# Any words we should ignore?
excluded_words:
  - typoci

# Would you like filenames to also be spellchecked?
spellcheck_filenames: true

Dictionaries

Development Languages

To help the spell checker detect words that are valid in the programming world, I've created a collection of language specific dictionaries which are stored in db/dict/contextual.

These are pragmatically generated by analysing open source projects.

Spoken Language Dictionaries

The en, en_GB & pt_BR dictionaries were built from https://github.com/en-wl/wordlist and they are stored in db/dict/imported.

Other languages have been imported via NPM from wooorm/dictionaries.

Testing

  • Run docker-compose run --rm web bin/setup & docker-compose run --rm web rspec.