5941N/A# These are all the cops that are enabled in the default configuration.
5941N/A Description: 'Use alias_method instead of alias.'
5941N/A Align the elements of an array literal if they span more than
5941N/A Align the elements of a hash literal if they span more than
5941N/A Align the parameters of a method call if they span more
5941N/A Description: 'Use Array#join instead of Array#*.'
6006N/A Description: 'Use only ascii symbols in comments.'
6006N/A Description: 'Use only ascii symbols in identifiers.'
5941N/A Description: 'Checks for uses of Module#attr.'
5941N/A Description: 'Avoid the use of BEGIN blocks.'
5941N/A Description: 'Checks if usage of %() or %Q() matches configuration.'
5941N/A Description: 'Do not use block comments.'
5941N/A Description: 'Put end statement of multiline block on its own line.'
5941N/A Avoid using {...} for multi-line blocks (multiline chaining is
5941N/A Description: 'Enforce braces style inside hash parameters.'
5941N/A Description: 'Avoid explicit use of the case equality operator(===).'
Description: 'Checks for uses of character literals.'
Description: 'Use CamelCase for classes and modules.'
Description: 'Checks style of children classes and modules.'
Description: 'Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.'
Description: 'Avoid the use of class variables.'
Description: 'Preferred collection methods.'
Description: 'Do not use :: for method call.'
Checks formatting of special comments
(TODO, FIXME, OPTIMIZE, HACK, REVIEW).
Description: 'Indentation of comments.'
Description: 'Constants should use SCREAMING_SNAKE_CASE.'
Description: 'Use def with parentheses when there are arguments.'
Description: 'Checks for use of deprecated Hash methods.'
Description: 'Document classes and non-namespace modules.'
Description: 'Checks the position of the dot in multi-line method calls.'
Description: 'Checks for uses of double negation (!!).'
Description: 'Prefer `each_with_object` over `inject` or `reduce`.'
Description: 'Use empty lines between defs.'
Description: "Don't use several empty lines in a row."
Description: "Keep blank lines around access modifiers."
Description: "Keeps track of empty lines around expression bodies."
Description: 'Use UTF-8 as the source file encoding.'
Description: 'Avoid the use of END blocks.'
Description: 'Use Unix-style line endings.'
Description: 'Favor the use of Fixnum#even? && Fixnum#odd?'
Description: 'Use snake_case for source file names.'
Description: 'Checks for flip flops'
Description: 'Checks use of for or each in multiline loops.'
Description: 'Enforce the use of Kernel#sprintf, Kernel#format or String#%.'
Description: 'Do not introduce global variables.'
Description: 'Check for conditionals that can be replaced with guard clauses'
Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
Favor modifier
if/unless usage when you have a
Description: 'Never use if x; .... Use the ternary operator instead.'
Description: 'Keep indentation straight.'
Description: 'Use 2 spaces for indentation.'
Checks the indentation of the first element in an array
Description: 'Checks the indentation of the first key in a hash literal.'
Description: 'Use the new lambda literal syntax for single-line blocks.'
Description: 'Use
lambda.call(...) instead of lambda.(...).'
Description: 'Comments should start with a space.'
Use \ instead of + or << to concatenate two string literals at
Description: 'Do not use parentheses for method calls with no arguments.'
Checks if the method definitions have or don't have
Description: 'Use the configured style when naming methods.'
Description: 'Checks for usage of `extend self` in modules.'
Description: 'Avoid multi-line chains of blocks.'
Description: 'Ensures newlines after multiline block do statements.'
Description: 'Never use then for multi-line
if/unless.'
Avoid multi-line ?: (the ternary operator);
Favor unless over if for negative conditions
Description: 'Favor until over while for negative conditions.'
Description: 'Use one expression per branch in a ternary operator.'
Description: 'Use `next` to skip iteration instead of a condition at the end.'
Description: 'Prefer
x.nil? to x == nil.'
Description: 'Checks for redundant nil checks.'
Description: 'Use ! instead of not.'
Add underscores to large numeric literals to improve their
Favor the ternary operator(?:) over
Description: 'When defining binary operators, name the argument other.'
Don't use parentheses around the condition of an
Description: 'Use `%`-literal delimiters consistently'
Description: 'Checks if uses of %Q/%q match the configured preference.'
Description: 'Avoid Perl-style regex back references.'
Description: 'Check the names of predicate methods.'
Description: 'Checks the arguments passed to
raise/fail.'
Description: "Don't use begin blocks when they are not needed."
Description: "Checks for an obsolete RuntimeException argument in
raise/fail."
Description: "Don't use return where it's not required."
Description: "Don't use self where it's not needed."
Use %r for regular expressions matching more than
`MaxSlashes` '/' characters.
Use %r only for regular expressions matching more than
`MaxSlashes` '/' character.
Description: 'Avoid using rescue in its modifier form.'
Checks for places where self-assignment shorthand should have
Description: "Don't use semicolons to terminate expressions."
Description: 'Checks for proper usage of fail and raise.'
Description: 'Enforces the names of some block params.'
Description: 'Avoid single-line methods.'
Checks that exactly one space is used between a method name
and the first argument for method calls without parentheses.
Description: 'Use spaces after colons.'
Description: 'Use spaces after commas.'
Never put a space between a method name and the opening
parenthesis in a method definition.
Description: Tracks redundant space after the ! operator.
Description: 'Use spaces after semicolons.'
Checks that the left block brace has or doesn't have space
Description: 'No spaces before commas.'
Checks for missing space between code and a comment on the
Description: 'No spaces before semicolons.'
Checks that block braces have or don't have surrounding space.
For blocks taking parameters, checks that the left brace has
or doesn't have trailing space.
Checks that the equals signs in parameter default assignments
have or don't have surrounding space depending on
Description: 'Use spaces around operators.'
Description: 'Put a space before the modifier keyword.'
Description: 'No spaces after [ or before ].'
Description: "Use spaces inside hash literal braces - or don't."
Description: 'No spaces after ( or before ).'
Description: 'Avoid Perl-style global variables.'
Description: 'Checks if uses of quotes match the configured preference.'
Description: 'No hard tabs.'
Description: 'Checks trailing blank lines and final newline.'
Description: 'Checks for trailing comma in parameter lists and literals.'
Description: 'Avoid trailing whitespace.'
Never use unless with else. Rewrite these with the positive
Description: 'Checks for %W when interpolation is not needed.'
Description: 'Checks for %q/%Q when single quotes or double quotes would do.'
Description: 'Checks for %x when `` would do.'
Don't interpolate global, instance and class variables
Description: 'Use the configured style when naming variables.'
Description: 'Use when x then ... for one-line cases.'
Description: 'Checks for redundant do after while or until.'
Description: 'Use %w or %W for arrays of words.'
#################### Metrics ################################
Description: 'Avoid excessive block nesting'
Description: 'Avoid classes longer than 100 lines of code.'
A complexity metric that is strongy correlated to the number
of test cases needed to validate a method.
Description: 'Limit lines to 80 characters.'
Description: 'Avoid methods longer than 10 lines of code.'
Description: 'Avoid parameter lists longer than three or four parameters.'
A complexity metric geared towards measuring complexity for a
#################### Lint ################################
Checks for ambiguous operators in the first argument of a
method invocation without parentheses.
Checks for ambiguous regexp literals in the first argument of
a method invocation without parenthesis.
Description: "Don't use assignment in conditions."
Description: 'Align block ends correctly.'
Checks for condition placed in a confusing position relative to
Description: 'Check for debugger calls.'
Description: 'Align ends corresponding to defs correctly.'
Description: 'Check for deprecated class method calls.'
Description: 'Check for odd code arrangement in an else block.'
Description: 'Checks for empty ensure block.'
Description: 'Checks for empty string interpolation.'
Description: 'Align ends correctly.'
Description: 'END blocks should not be placed inside method definitions.'
Description: 'Never use return in an ensure block.'
Description: 'The use of eval represents a serious security risk.'
Description: "Don't suppress exception."
Checks for invalid character literals with a non-escaped
Description: 'Checks of literals used in conditions.'
Description: 'Checks for literals used in interpolation.'
Checks for method calls with a space before the opening
Use parentheses in the method call to avoid confusion
Description: 'Avoid rescuing the Exception class.'
Do not use the same name as outer local variable
for block arguments or block local variables.
Put a space between a method name and the first argument
in a method call without parentheses.
Description: 'Checks for Object#to_s usage in string interpolation.'
Description: 'Do not use prefix `_` for a variable that is used.'
Description: 'Checks for unused block arguments.'
Description: 'Checks for unused method arguments.'
Description: 'Unreachable code.'
Description: 'Checks for useless access modifiers.'
Description: 'Checks for useless assignment to a local variable.'
Description: 'Checks for comparison of something with itself.'
Description: 'Checks for useless `else` in `
begin..end` without `rescue`.'
Description: 'Checks for useless setter call to a local variable.'
##################### Rails ##################################
Description: 'Enforces consistent use of action filter methods.'
Description: 'Checks if the argument passed to default_scope is a block.'
Description: 'Prefer delegate method for delegations.'
Description: 'Prefer has_many :through to has_and_belongs_to_many.'
Description: 'Checks for calls to puts, print, etc.'
Checks for read_attribute(:attr) and
write_attribute(:attr, val).
Description: 'Checks the arguments of ActiveRecord scopes.'
Description: 'Use sexy validations.'