SpellingCI: No more spelling mistakes in your markdown flies!

Inakos
Erlang Battleground
4 min readFeb 14, 2017

--

Spelling CI / Sheldon

You probably know the feeling…

…when you fix a very important issue in that “super cool” open-source project. You keep all your attention to those parts of the code where your changes could affect something, you run the tests until you can confirm: “It is fixed now, I am sure”; but then again, you run all the tests again up until, as the brave developer you are, you click the “open pull request” button. You are happy because you know the problem is fixed, everyone is going to love you… but a reviewer appears and rejects your changes because, on the documentation, you wrote “wihle” instead of “while”. Damn!

You have to pay as much attention to your documentation as to your code, but when English is not your mother tongue, you will definitely have to spend time improving your grammar and spelling. If your problems have to do with grammar, sorry man, but you’ll have to continue studying… But if they are related to spelling, here at Inaka we developed a tool to help you out with that…

Sheldon

Sheldon is a simple Erlang Application for spell checking. You can find it here. Its API accepts a text (iodata() for Erlangers) and checks all the words. If sheldon doesn't understand a word it will try to help you with some suggestions. For suggestions we were inspired highly by the Elixir project spell_check.

Let’s try:

Sheldon has detected our misspelled word ("wihle") and the line where it is; it also gave us some suggestions ("while" and "wile") and a bazinga message.

But wait! sheldon doesn't recognize my royal name ("Felipe"). I confess that the "feline" suggestion is cool too, but my parents wouldn't be happy if I switch it now. This is because sheldonworks with a dictionary and, as expected, it is impossible to have all the words there. We have 2 choices here: update the dictionary or escape the word. Let's escape!

sheldon gives you the possibility to escape some words like "Felipe" in this example. We only have to create a configuration map like this.

Great, now “Felipe” is ignored.

That was a very simple example, but sheldon also provides the way to ignore patterns or blocks of code. For that you can check this example.

But… what if one day we are the Pull Request Reviewers? How can we prevent someone from writing “wihle”, even if we think “wihle” is correctly spelled?

Spelling CI

At Inaka we also wrote Spelling CI. It is a continuous integration tool built on top of sheldon. Basically you must log in using your Github account and select the Github projects you want to check.

spellingci is only integrated with Github platform. It works for both public and private repositories.

By default, it will check the spelling for all the .md and .markdown files in your branch, but you can configure spellingci in order to check different ones or ignore some words, patterns, blocks of code… all through a configuration json file.

Every time sheldon finds a misspelled word, it will write a comment there with the suggested words.

Lovely, isn’t it?

Conclusion

As software developers, we tend to focus entirely on the code and sometimes we forget about the spelling. With sheldon and spellingci, at least we have help. For example, this blog is a Github repository, so now we are going to check our post with sheldon/spellingci

And remember: for grammar… keep studying!

--

--