reek
Detect code smells in Ruby source files
TLDR
Check Ruby code for smells
SYNOPSIS
reek [options] [files...]
DESCRIPTION
Reek is a static analysis tool that detects code smells in Ruby source files, reporting potential design problems such as long methods, feature envy, data clumps, and excessive parameter lists. It examines code structure and naming patterns to identify areas that may benefit from refactoring, based on principles from Martin Fowler's refactoring catalog.
Output can be formatted as text, YAML, JSON, or HTML for integration with CI pipelines and code review workflows. Individual smell types can be included or excluded with --only and --except, and project-wide configuration in .reek.yml allows tuning thresholds and excluding paths.
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
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
SMELL TYPES
FeatureEnvy - Wrong class responsibility
DataClump - Data always together
LongParameterList - Too many parameters
DuplicateMethodCall - Repeated calls
CONFIGURATION (.reek.yml)
TooManyStatements:
max_statements: 10
exclude_paths:
- spec/
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.
