This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
Getting Started
First, make sure you have Ruby and ruby gems; then see the Installation page to get a copy of Reek. Now let’s put it to work!
Imagine you have a source file called csv_writer.rb with the following contents:
class CsvWriter
def write_line(fields)
if (fields.length == 0)
puts
else
write_field(fields[0])
1.upto(fields.length-1) do |i|
print ","
write_field(fields[i])
end
puts
end
end
#...
end
Now point Reek at the file to get a smell report:
$ reek csv_writer.rb
CsvWriter#write_line calls fields.length multiple times (Duplication)
CsvWriter#write_line has approx 6 statements (Long Method)
CsvWriter#write_line/block has the variable name 'i' (Uncommunicative Name)
That’s it — you’re up and running with Reek!
(Note that Reek isn’t yet able to see all of the problems with your code. So for example it can’t see that the CsvWriter#write_line method is both formatting and outputting the CSV strings — or indeed that the CsvWriter class similarly has more than one responsibility.)
Next you’ll probably want to explore Reek’s Command-Line Options and Configuration Files, or take a look at Reek-Driven Development.






