LinuxCommandLibrary

reek

TLDR

Check Ruby code for smells

$ reek [file.rb]
copy
Check entire project
$ reek
copy
Check with specific format
$ reek --format [yaml] [file.rb]
copy
Show available smell types
$ reek --smell-types
copy
Exclude specific smells
$ reek --except [TooManyStatements] [file.rb]
copy

SYNOPSIS

reek [options] [files...]

DESCRIPTION

Reek is a code smell detector for Ruby. It analyzes Ruby code and reports potential design problems like long methods, feature envy, and data clumps.

PARAMETERS

-f, --format format

Output format (text, yaml, json, html).
--smell-types
List available smells.
--except smells
Exclude smells.
--only smells
Check only specified smells.
-c, --config file
Configuration file.

EXAMPLES

$ # Check file
reek app/models/user.rb

# Check directory
reek app/

# JSON output
reek --format json app/ > smells.json

# List smell types
reek --smell-types

# Specific smells only
reek --only "TooManyStatements,LongMethod" app/

# With configuration
reek -c .reek.yml
copy

SMELL TYPES

$ TooManyStatements  - Method too long
FeatureEnvy        - Wrong class responsibility
DataClump          - Data always together
LongParameterList  - Too many parameters
DuplicateMethodCall - Repeated calls
copy

CONFIGURATION (.reek.yml)

$ detectors:
  TooManyStatements:
    max_statements: 10
  exclude_paths:
    - spec/
copy

CAVEATS

Ruby-specific. Some smells may be false positives. Configure per project.

HISTORY

Reek was created by Kevin Rutherford as a Ruby code smell detector based on Martin Fowler's refactoring concepts.

SEE ALSO

rubocop(1), ruby(1), brakeman(1)

Copied to clipboard