Showing 72 of 72 total issues
Line is too long. [162/120] Open
raise FitgemOauth2::InvalidDateArgument, "Date used must be a date/time object or a string in the format YYYY-MM-DD; supplied argument is a #{date.class}"
- Exclude checks
Line is too long. [161/120] Open
raise FitgemOauth2::InvalidTimeArgument, "Time used must be a DateTime/Time object or a string in the format hh:mm; supplied argument is a #{time.class}"
- Exclude checks
Do not prefix writer method names with set_
. Open
def set_headers(request)
- Read upRead up
- Exclude checks
This cop makes sure that accessor methods are named properly.
Example:
# bad
def set_attribute(value)
end
# good
def attribute=(value)
end
# bad
def get_attribute
end
# good
def attribute
end
Avoid the use of the case equality operator ===
. Open
fn = error_handler.find {|k, _| k === response.status }
- Read upRead up
- Exclude checks
This cop checks for uses of the case equality operator(===).
Example:
# bad
Array === something
(1..100) === 7
/something/ === some_string
# good
something.is_a?(Array)
(1..100).include?(7)
some_string =~ /something/
Unused method argument - end_date
. Open
def intraday_series_guard(start_date:, end_date:, detail_level:, start_time:, end_time:)
- Read upRead up
- Exclude checks
This cop checks for unused method arguments.
Example:
# bad
def some_method(used, unused, _unused_but_allowed)
puts used
end
Example:
# good
def some_method(used, _unused, _unused_but_allowed)
puts used
end
Line is too long. [121/120] Open
raise FitgemOauth2::InvalidArgumentError, 'resource and start_date are required parameters. Please specify both.'
- Exclude checks
Line is too long. [135/120] Open
raise FitgemOauth2::InvalidArgumentError, "Please specify the defail level. Detail level should be one of #{HR_DETAIL_LEVELS}."
- Exclude checks
Use a guard clause instead of wrapping the code inside a conditional expression. Open
if type && BODY_GOALS.include?(type)
- 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
Avoid the use of the case equality operator ===
. Open
if semantic === 'yesterday'
- Read upRead up
- Exclude checks
This cop checks for uses of the case equality operator(===).
Example:
# bad
Array === something
(1..100) === 7
/something/ === some_string
# good
something.is_a?(Array)
(1..100).include?(7)
some_string =~ /something/
Line is too long. [121/120] Open
def intraday_heartrate_time_series(start_date: nil, end_date: nil, detail_level: nil, start_time: nil, end_time: nil)
- Exclude checks
Line is too long. [125/120] Open
raise FitgemOauth2::InvalidArgumentError, "Invalid resource: #{resource}. Valid resources are #{ACTIVITY_RESOURCES}."
- Exclude checks
Use (time =~ /\d{2}:\d{2}/).zero?
instead of (time =~ /\d{2}:\d{2}/) == 0
. Open
if (time =~ /\d{2}:\d{2}/) == 0
- Read upRead up
- Exclude checks
This cop checks for usage of comparison operators (==
,
>
, <
) to test numbers as zero, positive, or negative.
These can be replaced by their respective predicate methods.
The cop can also be configured to do the reverse.
The cop disregards #nonzero?
as it its value is truthy or falsey,
but not true
and false
, and thus not always interchangeable with
!= 0
.
The cop ignores comparisons to global variables, since they are often
populated with objects which can be compared with integers, but are
not themselves Interger
polymorphic.
Example: EnforcedStyle: predicate (default)
# bad
foo == 0
0 > foo
bar.baz > 0
# good
foo.zero?
foo.negative?
bar.baz.positive?
Example: EnforcedStyle: comparison
# bad
foo.zero?
foo.negative?
bar.baz.positive?
# good
foo == 0
0 > foo
bar.baz > 0