trivelop @rrrene on

Credo: Introducing Lint attributes

I just released v0.3.3 of Credo, a static analysis tool for the Elixir language.

With the v0.3.0 release we finally introduced support for per-function exclusion of checks. This has been a community requested feature since the very beginning and I am happy to announce: it's finally here.

I was opposed to "magic comments" like # credo: <check-name>:off, since they would clutter your code, be very tool-specific and not very "Elixirish".

As it turns out the solution was quiet easy: Let's use a module attribute like @doc, which also contains code-relevant information which is often written in comments in other environments. Building on this idea, Credo now let's you use a module attribute named @lint to configure linting for specific functions.

@lint attributes let you exclude specific functions completely:

# Case 1: don't lint anything inside `my_fun`

@lint false
def my_fun do

In my mind, this reads just right. Given that you should use these function-specific exclusion rarely, it clearly communicates intention and does not clutter your code. But say you have a function where a specific check fails, but you know that this is an instance where you are fine with it. You can now mark that function to ignore all issues generated by that particular check (using the same syntax used in the config file):

# Case 2: don't run the TagTODO check inside `my_fun`

@lint {Credo.Check.Design.TagTODO, false}
def my_fun do

To exclude more than one check, e.g. a whole category of checks, you can use a Regex instead of the check module:

# Case 3: don't run any Refactor checks inside `my_fun`

@lint {~r/Refactor/, false}
def my_fun do

Finally, you can supply multiple tuples as a list and combine all of the above:

# Case 4: combine the above

@lint [{Credo.Check.Design.TagTODO, false}, {~r/Refactor/, false}]
def my_fun do

I hope you enjoy this release as much as I do. Thanks to all your feedback, we're already at v0.3.3.

You can check out Credo on GitHub.

Elixir Carnival

Right now there is a yearly celebration taking place where I live called "Fasching" or simply "Carnival". People dress up as all kinds of persons, like pirates, tussis, sailors or ladybug couple with an age difference. I know, Germans, right? ;-)

In a way this coming week is also going to be my personal "Elixir Carnival" as I plan to dress up to look like a serious member of the Open Source community, release a bunch of software and even give a talk about it in the end.

I would like to share this now, because I owe all of this to a very supportive and welcoming community of fellow Alchemists, but there will hardly be time to write an appropriate blog post next week.

So, here we go:

  • Monday The @elixirstatus Twitter account should pass the 1,000 follower mark around this date. The steady growth of this community makes me really happy.
  • Tuesday Credo will see its v0.3.0 release around Tuesday, introducing new checks, UI improvements and the @lint attribute to its analysis (preliminary CHANGELOG here). As with ElixirStatus, I can't describe how glad I am that this project is so well received.
  • Thursday I am really excited to give my first Elixir talk at ElixirRuhr on Thursday. It will be titled "Good Tooling educates" and I will upload the slides to SpeakerDeck after the event!
  • Friday And finally HexFaktor - an upcoming service to monitor your projects' Hex deps - is scheduled to start in private beta at the end of the week. My gut tells me this will be in private beta for a couple of weeks to ensure everything runs smoothly. You can register for the beta on

Since there are things like day job emergencies and family life to account for, some of these might happen a day later, but the above represents the overall plan for the week.

Let me finish with the original intent of this post: Saying Thank you! to everyone who has been along for the ride. I could not imagine more fulfilling side projects and both the Elixir and Ruby communities have been so supportive over the last 2 years. It really means something to me.

Thank you!

:heart: :green_heart: :blue_heart: :yellow_heart: :purple_heart:

2015 Roundup - Credo: Teaching changed my Life

This is the final part in a series discussing the projects that shaped "my" 2015.

After the success of Inch, a documentation analysis tool for Ruby, and giving a talk at EuRuKo 2015 about building this rather unconventional tool, I decided to create a similar tool for classic code analysis.

To understand where this came from, you have to know that I have spent the last two years teaching at local universities (next to my day job). Teaching has proven an unexpectedly krass and rewarding experience. I would not have believed it if you told me beforehand, but preparing lessons for students has led me to think very differently about how people approach problem solving.

So, with this background, the feedback from EuRuKo and my personal passion for Elixir, I decided to build a code linter that does not spout "YOU'RE WRONG!!!11" but instead teaches you why you should probably reconsider your code here and there. This effort to create a less dogmatic code linter soon got a name: Credo, announced in November.

It is really too early to tell, but my gut tells me this project will occupy most of my time in 2016. As far as I am concerned, Credo is off to a phenomenal start. The initial reception by the community was an absolute blast. I worked on it for two months and wasn't really sure if people would dig the concept. And then I kind of tanked the initial release, since I had some wrong ideas about how Elixir applications across Hex packages work together.

It was an emotional rollercoaster. ;-)

We're now at version v0.2.5 and I am super happy with the response on Twitter and elsewhere. There is a steady stream of bug reports, new ideas and PRs on GitHub. And last but not least, Credo will probably have surpassed Inch in terms of internet points (a.k.a. GitHub stars) as you read this.

That's it for 2015. It was a pleasure, being in Open Source, giving my first talk, coding Ruby, really focusing on Elixir during the last quarter. I really can't thank people enough for their kind words, constructive feedback and encouraging me to do all this and try seemingly crazy stuff.

Thank you all and see you in 2016. :heart:

Fork me on GitHub