Showing 829 of 829 total issues
Prefer single quoted strings Open
@import "compass";
- Exclude checks
0px
should be written without units as 0
Open
margin: 0px;
- Exclude checks
Shorthand form for property border-radius
should be written more concisely as 1px
instead of 1px 1px 1px 1px
Open
border-radius: 1px 1px 1px 1px;
- Exclude checks
Use alias
instead of alias_method
in a class body. Open
alias_method :facebook, :all
- Read upRead up
- Exclude checks
This cop enforces the use of either #alias
or #alias_method
depending on configuration.
It also flags uses of alias :symbol
rather than alias bareword
.
Example: EnforcedStyle: prefer_alias (default)
# bad
alias_method :bar, :foo
alias :bar :foo
# good
alias bar foo
Example: EnforcedStyle: preferaliasmethod
# bad
alias :bar :foo
alias bar foo
# good
alias_method :bar, :foo
Avoid using id selectors Open
#twitter-button {
- Exclude checks
Rule declaration should be preceded by an empty line Open
legend, .pictures {
- Exclude checks
Prefer single-quoted strings when you don't need string interpolation or special symbols. Open
user = User.from_omniauth(request.env["omniauth.auth"])
- Read upRead up
- Exclude checks
Checks if uses of quotes match the configured preference.
Example: EnforcedStyle: single_quotes (default)
# bad
"No special symbols"
"No string interpolation"
"Just text"
# good
'No special symbols'
'No string interpolation'
'Just text'
"Wait! What's #{this}!"
Example: EnforcedStyle: double_quotes
# bad
'Just some text'
'No special chars or interpolation'
# good
"Just some text"
"No special chars or interpolation"
"Every string in #{project} uses double_quotes"
Space inside string interpolation detected. Open
notice: "You unfavorited #{ @property.category } at #{ @property.street }"
- Read upRead up
- Exclude checks
This cop checks for whitespace within string interpolations.
Example: EnforcedStyle: no_space (default)
# bad
var = "This is the #{ space } example"
# good
var = "This is the #{no_space} example"
Example: EnforcedStyle: space
# bad
var = "This is the #{no_space} example"
# good
var = "This is the #{ space } example"
Line is too long. [87/80] Open
@favs_quicklist = current_user.favorites.includes(:images).limit(4) if current_user
- Exclude checks
Extra empty line detected at class body beginning. Open
def create
- Read upRead up
- Exclude checks
This cops checks if empty lines around the bodies of classes match the configuration.
Example: EnforcedStyle: empty_lines
# good
class Foo
def bar
# ...
end
end
Example: EnforcedStyle: emptylinesexcept_namespace
# good
class Foo
class Bar
# ...
end
end
Example: EnforcedStyle: emptylinesspecial
# good
class Foo
def bar; end
end
Example: EnforcedStyle: noemptylines (default)
# good
class Foo
def bar
# ...
end
end
Line is too long. [94/80] Open
redirect_to compare_properties_path, notice: 'Successfuly added property for comparison'
- Exclude checks
Line is too long. [86/80] Open
raise ArgumentError, ":in and :within must be a Range" unless range.is_a?(Range)
- Exclude checks
Use the new Ruby 1.9 hash syntax. Open
CHECKS = { :is => :==, :minimum => :>=, :maximum => :<= }.freeze
- Read upRead up
- Exclude checks
This cop checks hash literal syntax.
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
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
{d: 1, 'e' => 2} # technically not forbidden
Example: EnforcedStyle: hash_rockets
# bad
{a: 1, b: 2}
{c: 1, 'd' => 5}
# good
{:a => 1, :b => 2}
Example: EnforcedStyle: nomixedkeys
# bad
{:a => 1, b: 2}
{c: 1, 'd' => 2}
# good
{:a => 1, :b => 2}
{c: 1, d: 2}
Example: EnforcedStyle: ruby19nomixed_keys
# bad
{:a => 1, :b => 2}
{c: 2, 'd' => 3} # should just use hash rockets
# good
{a: 1, b: 2}
{:c => 3, 'd' => 4}
Use the -> { ... }
lambda literal syntax for single line lambdas. Open
DEFAULT_TOKENIZER = lambda { |value| value.split(//) }
- Read upRead up
- Exclude checks
This cop (by default) checks for uses of the lambda literal syntax for single line lambdas, and the method call syntax for multiline lambdas. It is configurable to enforce one of the styles for both single line and multiline lambdas as well.
Example: EnforcedStyle: linecountdependent (default)
# bad
f = lambda { |x| x }
f = ->(x) do
x
end
# good
f = ->(x) { x }
f = lambda do |x|
x
end
Example: EnforcedStyle: lambda
# bad
f = ->(x) { x }
f = ->(x) do
x
end
# good
f = lambda { |x| x }
f = lambda do |x|
x
end
Example: EnforcedStyle: literal
# bad
f = lambda { |x| x }
f = lambda do |x|
x
end
# good
f = ->(x) { x }
f = ->(x) do
x
end
Do not use parallel assignment. Open
options[:minimum], options[:maximum] = range.begin, range.end
- Read upRead up
- Exclude checks
Checks for simple usages of parallel assignment. This will only complain when the number of variables being assigned matched the number of assigning variables.
Example:
# bad
a, b, c = 1, 2, 3
a, b, c = [1, 2, 3]
# good
one, two = *foo
a, b = foo()
a, b = b, a
a = 1
b = 2
c = 3
Prefer single quoted strings Open
@import "bootstrap/code";
- Exclude checks
Prefer single quoted strings Open
@import "bootstrap/labels-badges";
- Exclude checks
Prefer single quoted strings Open
@import "bootstrap/carousel";
- Exclude checks
Use //
comments everywhere Open
/*** Custom ***/
- Exclude checks
Color literals like rgb(194, 194, 194)
should only be used in variable declarations; they should be referred to via variable everywhere else. Open
color: rgb(194, 194, 194);
- Exclude checks