Skip to content
This repository

Execute Reek using command-lines of the form:

$ reek [options] files...

That is, the name of the tool (reek), optionally followed by any number of configuration switches, followed by any number of source file names. Execute
$ reek --help

to list details of the options available in your installed version of Reek.

Telling Reek Which Code to Check

If the Ruby code you want to check is held in source files,, invoke Reek like this:

$ reek lib/*.rb

More generally, if any command-line argument is a directory, Reek searches that directory and all sub-directories for Ruby source files. Thus
$ reek lib

would be equivalent to
$ reek lib/**/*.rb

Occasionally you may want to quickly check a code snippet without going to the trouble of creating a file to hold it. You can pass the snippet directly to Reek’s standard input:

$ echo "def x() true end" | reek
$stdin -- 1 warning:
  x has the name 'x' (Uncommunicative Name)

Output smell’s line number

By passing in a -n flag to the reek command, the output will suppress the line numbers.

$ cat -n mess.rb
     1	def clean ; end
     2	def x
     3	  ["a", "b"].map{ |l| l.upcase }
     4	end
$ reek -n mess.rb
mess.rb -- 4 warnings:
  x doesn't depend on instance state (UtilityFunction)
  x has the name 'x' (UncommunicativeMethodName)
  x has the variable name 'l' (UncommunicativeVariableName)
  x refers to l more than self (FeatureEnvy)

Otherwise line numbers will be shown as in the following example.

$ cat -n mess.rb
     1	def clean ; end
     2	def x
     3	  ["a", "b"].map{ |l| l.upcase }
     4	end
$ reek mess.rb
mess.rb -- 4 warnings:
  [2]:x doesn't depend on instance state (UtilityFunction)
  [2]:x has the name 'x' (UncommunicativeMethodName)
  [3]:x has the variable name 'l' (UncommunicativeVariableName)
  [2]:x refers to l more than self (FeatureEnvy)
Something went wrong with that request. Please try again.