gupta-ankit/fitgem_oauth2

View on GitHub

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}"
Severity: Minor
Found in lib/fitgem_oauth2/utils.rb by rubocop

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}"
Severity: Minor
Found in lib/fitgem_oauth2/utils.rb by rubocop

Do not prefix writer method names with set_.
Open

    def set_headers(request)
Severity: Minor
Found in lib/fitgem_oauth2/client.rb by rubocop

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 }
Severity: Minor
Found in lib/fitgem_oauth2/client.rb by rubocop

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:)
Severity: Minor
Found in lib/fitgem_oauth2/heartrate.rb by rubocop

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.'

Line is too long. [135/120]
Open

        raise FitgemOauth2::InvalidArgumentError, "Please specify the defail level. Detail level should be one of #{HR_DETAIL_LEVELS}."
Severity: Minor
Found in lib/fitgem_oauth2/heartrate.rb by rubocop

Use a guard clause instead of wrapping the code inside a conditional expression.
Open

      if type && BODY_GOALS.include?(type)

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'
Severity: Minor
Found in lib/fitgem_oauth2/utils.rb by rubocop

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)
Severity: Minor
Found in lib/fitgem_oauth2/heartrate.rb by rubocop

Line is too long. [125/120]
Open

        raise FitgemOauth2::InvalidArgumentError, "Invalid resource: #{resource}. Valid resources are #{ACTIVITY_RESOURCES}."
Severity: Minor
Found in lib/fitgem_oauth2/activity.rb by rubocop

Use (time =~ /\d{2}:\d{2}/).zero? instead of (time =~ /\d{2}:\d{2}/) == 0.
Open

      if (time =~ /\d{2}:\d{2}/) == 0
Severity: Minor
Found in lib/fitgem_oauth2/utils.rb by rubocop

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
Severity
Category
Status
Source
Language