The rebar3_sheldon: Spell check your Erlang code with Sheldon

Hi All! In The Erlang spell checker: Sheldon was described amazing library for spell checking. Today I want to present new GitHub - vkatsuba/rebar3_sheldon: A rebar plugin for spellchecking which we made together with @elbrujohalcon. New plugin also is available on hex.pm/packages/rebar3_sheldon. Here how it’s works:
Add new plugin into rebar.config:

{project_plugins, [{rebar3_sheldon, "~> 0.3.1"}]}.

And just run plugin with rebar:

$ rebar3 spellcheck
===> Fetching rebar3_sheldon
===> Compiling rebar3_sheldon
===> Youre welcome. And if he has twins, we can do all kinds of neat experiments on them.:
test/test_SUITE.erl:1: The word "Speling" in string is unknown. Maybe you wanted to use "speeling" or "speiling" or ....?
test/test_SUITE.erl:2: The word "fdfdf" in string is unknown.
test/test_SUITE.erl:3: The word "Unicode" in comment is unknown. Maybe you wanted to use "uncoded"?

As you can see, the plugin has a friendly output format, akin to those produced by rebar3_format, rebar3_hank, and other famous tools.

You can also use extra arguments in shell:

$ rebar3 -h spellcheck
Plugin for spellcheck by sheldon
Usage: rebar3 spellcheck [-f <files>] [-i <ignore>] [-r <ignore_regex>]
                         [-d <default_dictionary>]
                         [-a <additional_dictionaries>]

  -f, --files                    List of files for spellchecker
  -i, --ignore                   List of ignore files for spellchecker
  -r, --ignore_regex             Regular exemptions for ignore lines
  -d, --default_dictionary       Set default dictionary
  -a, --additional_dictionaries  List of additional dictionaries

Or configure plugin in rebar.config like:

{spellcheck, [
    {files, ["src/*.erl", "src/*/*.erl", "include/*.hrl"]},
    {ignore, ["src/*_ignore.erl"]},
    {ignore_regex, "[_@./#&+-=%*]"},
    {default_dictionary, "path/to/default_dictionary.txt"},
    {additional_dictionaries, ["path/to/custom_dictionary_1.txt", "path/to/custom_dictionary_2.txt"]}
]}.

You can also read more in Erlang Blog Posts - #12 by vkatsuba.

Enjoy! :metal: And feel free to leave any questions, opinions and feedback.

7 Likes

Hah, that’s quite awesome! ^.^

3 Likes

Great stuff! This will save people reviewing my PRs some grief surely :wink:

4 Likes