Git Product home page Git Product logo

reek's Introduction

Reek -- code smell detection for Ruby

Build Status

Reek is a tool that examines Ruby classes, modules and methods and reports any code smells it finds. Install it like this:

$ gem install reek

and run it like this:

$ reek [options] [dir_or_source_file]*

For a full list of command-line options see the Reek wiki[http://wiki.github.com/kevinrutherford/reek/command-line-options] or run

$ reek --help

Example

Imagine a source file demo.rb containing:

class Dirty
  # This method smells of :reek:NestedIterators but ignores them
  def awful(x, y, offset = 0, log = false)
    puts @screen.title
    @screen = widgets.map {|w| w.each {|key| key += 3}}
    puts @screen.contents
  end
end

Reek will report the following code smells in this file:

$ reek demo.rb
spec/samples/demo/demo.rb -- 6 warnings:
  Dirty has no descriptive comment (IrresponsibleModule)
  Dirty#awful has 4 parameters (LongParameterList)
  Dirty#awful has boolean parameter 'log' (ControlCouple)
  Dirty#awful has the parameter name 'x' (UncommunicativeName)
  Dirty#awful has the parameter name 'y' (UncommunicativeName)
  Dirty#awful has the variable name 'w' (UncommunicativeName)

Features

Reek currently includes checks for some aspects of Control Couple, Data Clump, Feature Envy, Large Class, Long Method, Long Parameter List, Simulated Polymorphism, Uncommunicative Name and more. See the Reek wiki for up to date details of exactly what Reek will check in your code.

Tool Integration

Reek integrates with many of your favourite tools:

  • require 'reek/rake/task' to easily add Reek to your Rakefile
  • require 'reek/spec' to add the should_not reek custom matcher to your Rspec examples
  • Reek is fully compliant with Ruby 1.8.6, 1.8.7 and 1.9.1

Dependencies

Reek makes use of the following other gems:

  • ruby_parser
  • sexp_processor
  • ruby2ruby

Learn More

Find out more about Reek from any of the following sources:

reek's People

Contributors

arwagner avatar danmayer avatar gilesbowkett avatar jhwist avatar kevinrutherford avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.