beneggett/sportradar-api

View on GitHub
lib/sportradar/api/basketball/game.rb

Summary

Maintainability
D
1 day
Test Coverage

Class Game has 55 methods (exceeds 20 allowed). Consider refactoring.
Open

      class Game < Data
        attr_accessor :response, :id, :title, :home_id, :away_id, :score, :status, :coverage, :time_zone, :scheduled, :venue, :broadcast, :clock, :duration, :attendance, :team_stats, :player_stats, :changes, :media_timeouts

        attr_accessor :period
        @all_hash = {}
Severity: Major
Found in lib/sportradar/api/basketball/game.rb - About 7 hrs to fix

    Method update has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

            def update(data, source: nil, **opts)
              # via pbp
              @status       = data['status']                if data['status']
              @coverage     = data['coverage']              if data['coverage']
              @home_id      = data['home_team'] || data.dig('home', 'id')   if data['home_team'] || data.dig('home', 'id')
    Severity: Minor
    Found in lib/sportradar/api/basketball/game.rb - About 3 hrs 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

    File game.rb has 287 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module Sportradar
      module Api
        module Basketball
          class Game < Data
            attr_accessor :response, :id, :title, :home_id, :away_id, :score, :status, :coverage, :time_zone, :scheduled, :venue, :broadcast, :clock, :duration, :attendance, :team_stats, :player_stats, :changes, :media_timeouts
    Severity: Minor
    Found in lib/sportradar/api/basketball/game.rb - About 2 hrs to fix

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

              def ingest_pbp(data)
                period_name = 'periods'
                update(data, source: :pbp)
                period_data = if data[period_name] && !data[period_name].empty?
                  @period = data[period_name].last['sequence'].to_i
      Severity: Minor
      Found in lib/sportradar/api/basketball/game.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

      There are no issues that match your filters.

      Category
      Status