Blog Home

Integrating codespell into your CI


If you have never heard of codespell, it's a command line utility to check for common misspellings with the possibility to add your own dictionaries. I have looked lately at integrating it as part of the CI for some of my projects.

Gitlab CI

Currently codespell doesn't provide a docker image that could be used for CI. You can create your own or use a pretty simple image I have setup and pushed to

The docker image is a simple as

FROM python:3.8

RUN pip3 install codespell

Once you have an image up and ready, you can add it to your .gitlab-ci.yml

  image: ""
    - codespell -S "*.png,*.po,.git,*.jpg" -f

-S argument is a comma separated glob pattern, directories or files to ignore. The -f argument makes codespell check the file names as well.

You can find more about the possible options you can pass by running codepsell --help

Github Actions

Codespell provides a Github Action so integrating it as a workflow should be straightforward

    branches: [master]

name: Spell Check

    runs-on: ubuntu-latest
      - uses: actions/checkout@v2
      - uses: codespell-project/actions-codespell@master
          check_filenames: true

See the list of arguments you can pass to the action.

By default codespell uses two dictionaries "clear" and "rare". You can tweak that list to use something else by passing --builtin "clear,usage,code".

This work is licensed under CC BY-NC-SA 4.0.