beneggett/sportradar-api

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

Summary

Maintainability
D
2 days
Test Coverage

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

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

        attr_reader :week_number, :year, :type

Severity: Major
Found in lib/sportradar/api/football/game.rb - About 1 day to fix

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

    module Sportradar
      module Api
        module Football
          class Game < Data
            attr_accessor :response, :id, :title, :home_id, :away_id, :score, :status, :coverage, :scheduled, :venue, :broadcast, :duration, :attendance, :team_stats, :player_stats, :changes, :lineup, :week, :quarter, :clock, :api
    Severity: Minor
    Found in lib/sportradar/api/football/game.rb - About 3 hrs to fix

      Method update_teams has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

              def update_teams(data)
                if data['summary']
                  @home.update(data.dig('summary', 'home'), game: self)
                  @away.update(data.dig('summary', 'away'), game: self)
                else
      Severity: Minor
      Found in lib/sportradar/api/football/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

      Method update has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def update(data, source: nil, **opts)
                @id           = data['id'] || @id
                # @year          = data['year'] || @week&.season.year
                # @type          = data['type'] || @week&.season.type
                # @week_number   = data['week'] || @week&.sequence
      Severity: Minor
      Found in lib/sportradar/api/football/game.rb - About 1 hr to fix

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

                def update(data, source: nil, **opts)
                  @id           = data['id'] || @id
                  # @year          = data['year'] || @week&.season.year
                  # @type          = data['type'] || @week&.season.type
                  # @week_number   = data['week'] || @week&.sequence
        Severity: Minor
        Found in lib/sportradar/api/football/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

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

                def realtime_state
                  if future?
                    'Scheduled'
                  elsif delayed?
                    'Delayed'
        Severity: Minor
        Found in lib/sportradar/api/football/game.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

        There are no issues that match your filters.

        Category
        Status