Checks if the length of a method exceeds some maximum value.
Comment lines can optionally be allowed.
The maximum allowed length is configurable.
You can set constructs you want to fold with CountAsOne.
Available are: 'array', 'hash', 'heredoc', and 'method_call'. Each construct
will be counted as one line regardless of its actual size.
NOTE: The ExcludedMethods and IgnoredMethods configuration is
deprecated and only kept for backwards compatibility.
Please use AllowedMethods and AllowedPatterns instead.
By default, there are no methods to allowed.
Checks if the length of a method exceeds some maximum value.
Comment lines can optionally be allowed.
The maximum allowed length is configurable.
You can set constructs you want to fold with CountAsOne.
Available are: 'array', 'hash', 'heredoc', and 'method_call'. Each construct
will be counted as one line regardless of its actual size.
NOTE: The ExcludedMethods and IgnoredMethods configuration is
deprecated and only kept for backwards compatibility.
Please use AllowedMethods and AllowedPatterns instead.
By default, there are no methods to allowed.
It can enforce either the use of the class hash rocket syntax or
the use of the newer Ruby 1.9 syntax (when applicable).
A separate offense is registered for each problematic pair.
The supported styles are:
ruby19 - forces use of the 1.9 syntax (e.g. {a: 1}) when hashes have
all symbols for keys
hash_rockets - forces use of hash rockets for all hashes
nomixedkeys - simply checks for hashes with mixed syntaxes
ruby19nomixed_keys - forces use of ruby 1.9 syntax and forbids mixed
syntax hashes
This cop has EnforcedShorthandSyntax option.
It can enforce either the use of the explicit hash value syntax or
the use of Ruby 3.1's hash value shorthand syntax.
The supported styles are:
always - forces use of the 3.1 syntax (e.g. {foo:})
never - forces use of explicit hash literal value
either - accepts both shorthand and explicit use of hash literal value
consistent - forces use of the 3.1 syntax only if all values can be omitted in the hash
Example: EnforcedStyle: ruby19 (default)
# bad
{:a => 2}
{b: 1, :c => 2}
# good
{a: 2, b: 1}
{:c => 2, 'd' => 2} # acceptable since 'd' isn't a symbol
It can enforce either the use of the class hash rocket syntax or
the use of the newer Ruby 1.9 syntax (when applicable).
A separate offense is registered for each problematic pair.
The supported styles are:
ruby19 - forces use of the 1.9 syntax (e.g. {a: 1}) when hashes have
all symbols for keys
hash_rockets - forces use of hash rockets for all hashes
nomixedkeys - simply checks for hashes with mixed syntaxes
ruby19nomixed_keys - forces use of ruby 1.9 syntax and forbids mixed
syntax hashes
This cop has EnforcedShorthandSyntax option.
It can enforce either the use of the explicit hash value syntax or
the use of Ruby 3.1's hash value shorthand syntax.
The supported styles are:
always - forces use of the 3.1 syntax (e.g. {foo:})
never - forces use of explicit hash literal value
either - accepts both shorthand and explicit use of hash literal value
consistent - forces use of the 3.1 syntax only if all values can be omitted in the hash
Example: EnforcedStyle: ruby19 (default)
# bad
{:a => 2}
{b: 1, :c => 2}
# good
{a: 2, b: 1}
{:c => 2, 'd' => 2} # acceptable since 'd' isn't a symbol
It can enforce either the use of the class hash rocket syntax or
the use of the newer Ruby 1.9 syntax (when applicable).
A separate offense is registered for each problematic pair.
The supported styles are:
ruby19 - forces use of the 1.9 syntax (e.g. {a: 1}) when hashes have
all symbols for keys
hash_rockets - forces use of hash rockets for all hashes
nomixedkeys - simply checks for hashes with mixed syntaxes
ruby19nomixed_keys - forces use of ruby 1.9 syntax and forbids mixed
syntax hashes
This cop has EnforcedShorthandSyntax option.
It can enforce either the use of the explicit hash value syntax or
the use of Ruby 3.1's hash value shorthand syntax.
The supported styles are:
always - forces use of the 3.1 syntax (e.g. {foo:})
never - forces use of explicit hash literal value
either - accepts both shorthand and explicit use of hash literal value
consistent - forces use of the 3.1 syntax only if all values can be omitted in the hash
Example: EnforcedStyle: ruby19 (default)
# bad
{:a => 2}
{b: 1, :c => 2}
# good
{a: 2, b: 1}
{:c => 2, 'd' => 2} # acceptable since 'd' isn't a symbol