Reek 3 has been released!

My beloved Reek gem has come quite a long way. During the last months we refactored so much of the source code that it almost feels like a new and shiny gem.

Right after the release of Reek 2 we started to work on Reek 3 which we released a couple of days ago.

 A stable API

The changes that I’m most exited about is that we agreed on a public API and implemented it as well. For this API to use you’ll basically just do something like this:

require 'reek'

reporter = Reek::Report::TextReport.new
examiner = Reek::Examiner.new("class Klazz; def m(a,b,c); end; end")
reporter.add_examiner examiner
reporter.show

which would give you this

5 warnings:
Klazz has no descriptive comment (IrresponsibleModule)
Klazz#m has the name 'm' (UncommunicativeMethodName)
Klazz#m has unused parameter 'a' (UnusedParameters)
Klazz#m has unused parameter 'b' (UnusedParameters)
Klazz#m has unused parameter 'c' (UnusedParameters)

Getting a stable API out is something that hopefully means a lot for projects who make use of Reek programmatically like Rubycritic.

The API is still rather small so you can quickly read up on everything you need to know in 5 minutes here.

 Excludable directories

We made directories excludable via configuration, a feature that was requested quite some times.

The way this works is that you just add a paragraph like this

exclude_paths:
  - app/views
  - app/controllers

to your Reek config and that’s it - Reek will ignore those directories when scanning.

 Singleton methods

We fixed one of the most annoying bugs that has been around for years. Until now, Reek would not recognise singleton methods if they were defined with the class << self syntax, meaning that this:

class C
  class << self
    def m(a)
      a.to_s
    end
  end
end

would incorrectly report UtilityFunction.
Now it will correctly recognise those methods as singleton methods.

 Compatibility

We dropped support Ruby 1.9. Time to move on.

What’s next?

 
2
Kudos
 
2
Kudos

Now read this

Kill all the mutants - a deep dive into mutation testing and how the Mutant gem works

As part of a presentation I’m hoping to give at the end of this year about abstract syntax trees and how you can leverage them I started to look into how the Mutant gem works. Mutant is the by far most advanced gem for doing mutation... Continue →