gupta-ankit/fitgem_oauth2

View on GitHub

Showing 9 of 72 total issues

Method weight_logs has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def weight_logs(start_date: nil, end_date: nil, period: nil)
      raise FitgemOauth2::InvalidArgumentError, 'start_date not specified.' unless start_date

      if period && end_date
        raise FitgemOauth2::InvalidArgumentError, 'both end_date and period specified. please provide only one.'
Severity: Minor
Found in lib/fitgem_oauth2/body_measurements.rb - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method intraday_activity_time_series has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def intraday_activity_time_series(resource: nil, start_date: nil, end_date: nil, detail_level: nil,
                                      start_time: nil, end_time: nil)

      # converting to symbol to allow developer to use either 'calories' or :calories
      resource = resource.to_sym
Severity: Minor
Found in lib/fitgem_oauth2/activity.rb - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method body_time_series has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def body_time_series(resource: nil, start_date: nil, end_date: nil, period: nil)
      unless resource && start_date
        raise FitgemOauth2::InvalidArgumentError, 'resource and start_date are required parameters. Please specify both.'
      end

Severity: Minor
Found in lib/fitgem_oauth2/body_measurements.rb - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method intraday_activity_time_series has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def intraday_activity_time_series(resource: nil, start_date: nil, end_date: nil, detail_level: nil,
                                      start_time: nil, end_time: nil)

      # converting to symbol to allow developer to use either 'calories' or :calories
      resource = resource.to_sym
Severity: Minor
Found in lib/fitgem_oauth2/activity.rb - About 1 hr to fix

    Method activity_time_series has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def activity_time_series(resource: nil, start_date: nil, end_date: nil, period: nil)
          unless resource && ACTIVITY_RESOURCES.include?(resource)
            raise FitgemOauth2::InvalidArgumentError, "Invalid resource: #{resource}. Valid resources are #{ACTIVITY_RESOURCES}."
          end
    
    
    Severity: Minor
    Found in lib/fitgem_oauth2/activity.rb - About 55 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method sleep_time_series has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def sleep_time_series(resource: nil, start_date: nil, end_date: nil, period: nil)
          raise FitgemOauth2::InvalidArgumentError, 'Start date not provided.' unless start_date
    
          unless resource && SLEEP_RESOURCES.include?(resource)
            raise FitgemOauth2::InvalidArgumentError, "Invalid resource: #{resource}. Valid resources are #{SLEEP_RESOURCES}."
    Severity: Minor
    Found in lib/fitgem_oauth2/sleep.rb - About 55 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method intraday_series_guard has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def intraday_series_guard(start_date:, end_date:, detail_level:, start_time:, end_time:)
          raise FitgemOauth2::InvalidArgumentError, 'Start date not provided.' unless start_date
    
          unless detail_level && HR_DETAIL_LEVELS.include?(detail_level)
            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 - About 45 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method body_fat_logs has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def body_fat_logs(start_date: nil, end_date: nil, period: nil)
          raise FitgemOauth2::InvalidArgumentError, 'must specify start_date' unless start_date
    
          url = ['user', user_id, 'body/log/fat/date', format_date(start_date)].join('/')
          url = [url, format_date(end_date)].join('/') if end_date
    Severity: Minor
    Found in lib/fitgem_oauth2/body_measurements.rb - About 35 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method format_date has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def format_date(date)
          return nil if date.nil?
    
          valid_semantic_date = %w[today yesterday].include? date
          valid_date_string = (date =~ /\d{4}\-\d{2}\-\d{2}/) == 0
    Severity: Minor
    Found in lib/fitgem_oauth2/utils.rb - About 25 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Severity
    Category
    Status
    Source
    Language