Showing 145 of 145 total issues
Trailing whitespace detected. Open
# - *activity_average*,
- Exclude checks
Trailing whitespace detected. Open
# - *slug*
- Exclude checks
Prefer single-quoted strings when you don't need string interpolation or special symbols. Open
"documentation_uri" => "https://www.rubydoc.info/github/natydev/fitbark/master"
- 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"
Use a guard clause instead of wrapping the code inside a conditional expression. Open
unless conn.success?
- Read upRead up
- Exclude checks
Use a guard clause instead of wrapping the code inside a conditional expression
Example:
# bad
def test
if something
work
end
end
# good
def test
return unless something
work
end
# also good
def test
work if something
end
# bad
if something
raise 'exception'
else
ok
end
# good
raise 'exception' if something
ok
Trailing whitespace detected. Open
# - *last_name*
- Exclude checks
unexpected token tCOLON
(Using Ruby 2.1 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
"date": set_on.to_s
- Exclude checks
unexpected token tCOLON
(Using Ruby 2.1 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
"to": to
- Exclude checks
Trailing whitespace detected. Open
# Original attribute names from source API:
- Exclude checks
Space missing inside }. Open
select{|h| h['status'].upcase == 'OWNER'}.map do |rel|
- Read upRead up
- Exclude checks
Checks that block braces have or don't have surrounding space inside them on configuration. For blocks taking parameters, it checks that the left brace has or doesn't have trailing space depending on configuration.
Example: EnforcedStyle: space (default)
# The `space` style enforces that block braces have
# surrounding space.
# bad
some_array.each {puts e}
# good
some_array.each { puts e }
Example: EnforcedStyle: no_space
# The `no_space` style enforces that block braces don't
# have surrounding space.
# bad
some_array.each { puts e }
# good
some_array.each {puts e}
Example: EnforcedStyleForEmptyBraces: no_space (default)
# The `no_space` EnforcedStyleForEmptyBraces style enforces that
# block braces don't have a space in between when empty.
# bad
some_array.each { }
some_array.each { }
some_array.each { }
# good
some_array.each {}
Example: EnforcedStyleForEmptyBraces: space
# The `space` EnforcedStyleForEmptyBraces style enforces that
# block braces have at least a spece in between when empty.
# bad
some_array.each {}
# good
some_array.each { }
some_array.each { }
some_array.each { }
Example: SpaceBeforeBlockParameters: true (default)
# The SpaceBeforeBlockParameters style set to `true` enforces that
# there is a space between `{` and `|`. Overrides `EnforcedStyle`
# if there is a conflict.
# bad
[1, 2, 3].each {|n| n * 2 }
# good
[1, 2, 3].each { |n| n * 2 }
Example: SpaceBeforeBlockParameters: true
# The SpaceBeforeBlockParameters style set to `false` enforces that
# there is no space between `{` and `|`. Overrides `EnforcedStyle`
# if there is a conflict.
# bad
[1, 2, 3].each { |n| n * 2 }
# good
[1, 2, 3].each {|n| n * 2 }
unexpected token tCOLON
(Using Ruby 2.1 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
"dog": {
- Exclude checks
Useless assignment to variable - e
. Open
rescue NameError => e
- Read upRead up
- Exclude checks
This cop checks for every useless assignment to local variable in every
scope.
The basic idea for this cop was from the warning of ruby -cw
:
assigned but unused variable - foo
Currently this cop has advanced logic that detects unreferenced reassignments and properly handles varied cases such as branch, loop, rescue, ensure, etc.
Example:
# bad
def some_method
some_var = 1
do_something
end
Example:
# good
def some_method
some_var = 1
do_something(some_var)
end
When using method_missing
, define respond_to_missing?
. Open
def method_missing(method, **args)
if respond_to?(method)
klass_handler(method).new(token: token, opts: args).response
else
super
- Read upRead up
- Exclude checks
This cop checks for the presence of method_missing
without also
defining respond_to_missing?
and falling back on super
.
Example:
#bad
def method_missing(name, *args)
# ...
end
#good
def respond_to_missing?(name, include_private)
# ...
end
def method_missing(name, *args)
# ...
super
end
Trailing whitespace detected. Open
# Original attribute names from source API:
- Exclude checks
Line is too long. [82/80] Open
# auth = Fitbark::Auth.new(client_id: client_id, redirect_uri: redirect_uri,
- Exclude checks
Trailing whitespace detected. Open
# Original attribute names from source API:
- Exclude checks
Trailing whitespace detected. Open
# - *username*
- Exclude checks
Trailing whitespace detected. Open
# Original attribute names from source API:
- Exclude checks
Trailing whitespace detected. Open
# Original attribute names from source API:
- Exclude checks
The use of eval
is a serious security risk. Open
eval("#{PREFIX_NAME_HANDLER}#{camel(handler.to_s)}")
- Read upRead up
- Exclude checks
This cop checks for the use of Kernel#eval
and Binding#eval
.
Example:
# bad
eval(something)
binding.eval(something)
Trailing whitespace detected. Open
#
- Exclude checks