Showing 387 of 387 total issues
Line is too long. [84/80] Open
Open
# #<Method: User(id: integer, username: string)(ActiveRecord::Base).current>
- Exclude checks
Do not use unless
with else
. Rewrite these with the positive case first. Open
Open
data = unless should_be_limited?
generate_printable_array
else
limited(generate_printable_array, width(array))
end
- Read upRead up
- Exclude checks
This cop looks for unless expressions with else clauses.
Example:
# bad
unless foo_bar.nil?
# do something...
else
# do a different thing...
end
# good
if foo_bar.present?
# do something...
else
# do a different thing...
end
Use %
instead of %Q
. Open
Open
"#<#{awesome_instance}\n#{data.join(%Q/,\n/)}\n#{outdent}>"
- Read upRead up
- Exclude checks
This cop checks if usage of %() or %Q() matches configuration.
Example: EnforcedStyle: bare_percent (default)
# bad
%Q(He said: "#{greeting}")
%q{She said: 'Hi'}
# good
%(He said: "#{greeting}")
%{She said: 'Hi'}
Example: EnforcedStyle: percent_q
# bad
%|He said: "#{greeting}"|
%/She said: 'Hi'/
# good
%Q|He said: "#{greeting}"|
%q/She said: 'Hi'/
Use %Q
only for strings that contain both single quotes and double quotes, or for dynamic strings that contain double quotes. Open
Open
"#<#{awesome_instance}\n#{data.join(%Q/,\n/)}\n#{outdent}>"
- Exclude checks
Surrounding space missing in default value assignment. Open
Open
def generic_prefix(iteration, width, padding='')
- Read upRead up
- Exclude checks
Checks that the equals signs in parameter default assignments have or don't have surrounding space depending on configuration.
Example:
# bad
def some_method(arg1=:default, arg2=nil, arg3=[])
# do something...
end
# good
def some_method(arg1 = :default, arg2 = nil, arg3 = [])
# do something...
end
Line is too long. [105/80] Open
Open
key.sub!(/(attr_\w+)\s(\:\w+)/, "#{colorize('\\1', :keyword)} #{colorize('\\2', :method)}")
- Exclude checks
Extra empty line detected at class body beginning. Open
Open
attr_reader :method, :inspector, :options
- 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