beneggett/sportradar-api

View on GitHub

Showing 102 of 185 total issues

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

        def update(data, **opts)
          if data["summaries"]
            update(data["summaries"][0])
          end
          if data["sport_event"]
Severity: Minor
Found in lib/sportradar/api/mma/fight.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

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

Method pitch_outcomes has 84 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def self.pitch_outcomes
          @pitch_outcomes ||= {
            'aBK'     => 'Balk',
            'aCI'     => 'Catcher Interference',
            'aD'      => 'Double',
Severity: Major
Found in lib/sportradar/api/baseball/pitch.rb - About 3 hrs to fix

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

            def update(data, **opts)
              @id             = data['id']             if data['id']
              @league_group = opts[:league_group] || data['league_group'] || @league_group
    
              if data['player']
    Severity: Minor
    Found in lib/sportradar/api/soccer/player.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

    Class Team has 26 methods (exceeds 20 allowed). Consider refactoring.
    Open

          class Team < Data
            attr_accessor :response, :id, :market, :name, :alias, :full_name, :venue, :records, :player_stats, :team_stats, :seed, :season, :type, :stats, :used_timeouts, :remaining_timeouts
    
            def initialize(data, **opts)
              @response = data
    Severity: Minor
    Found in lib/sportradar/api/football/team.rb - About 3 hrs to fix

      Class Team has 26 methods (exceeds 20 allowed). Consider refactoring.
      Open

            class Team < Data
              attr_reader :response
              attr_accessor :tournament_id, :venue, :player_stats
              attr_reader :id, :league_group, :name, :country, :country_code, :abbreviation, :qualifier
              alias :alias :abbreviation
      Severity: Minor
      Found in lib/sportradar/api/soccer/team.rb - About 3 hrs to fix

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

                def update(data, **opts)
                  @id           = data['id'] if data['id']
                  @league_group = opts[:league_group] || data['league_group'] || @league_group
                  # get_tournament_id(data, **opts)
        
        
        Severity: Minor
        Found in lib/sportradar/api/soccer/team.rb - About 2 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 update has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

                    def update(data, **opts)
                      @status           = data['status']            if data['status']            # "ACT",
                      @full_name        = data['full_name']         if data['full_name']         # "Festus Ezeli",
                      @first_name       = data['first_name']        if data['first_name']        # "Festus",
                      @last_name        = data['last_name']         if data['last_name']         # "Ezeli",
          Severity: Minor
          Found in lib/sportradar/api/basketball/nba/player.rb - About 2 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

          Class Pitch has 23 methods (exceeds 20 allowed). Consider refactoring.
          Open

                class Pitch < Data
                  attr_accessor :response, :id, :at_bat, :outcome_id, :status, :count, :is_ab_over, :is_hit, :warming_up, :runners, :errors, :pitch_type_name, :x, :y, :zone, :total_pitch_count, :atbat_pitch_count, :speed, :outcome, :hit_type, :balls, :strikes, :outs, :fielders
          
                  def initialize(data, **opts)
                    @response = data
          Severity: Minor
          Found in lib/sportradar/api/baseball/pitch.rb - About 2 hrs to fix

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

                    def update(data, **opts)
                      @type           = data['type']                        if data['type']
                      @time           = Time.parse(data['time'])            if data['time']
                      @period         = data['period']                      if data['period']
                      @period_type    = data['period_type']                 if data['period_type']
            Severity: Minor
            Found in lib/sportradar/api/soccer/event.rb - About 2 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

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

                    def update(data, source: nil, **opts)
                      # update stuff
                      @id     = data['id'] if data['id']
                      if data['season'].is_a?(Hash)
                        @season = data.dig('season', 'year')  if data.dig('season', 'year')
            Severity: Minor
            Found in lib/sportradar/api/football/nfl.rb - About 2 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

            Class Team has 22 methods (exceeds 20 allowed). Consider refactoring.
            Open

                  class Team < Data
                    attr_accessor :response, :id, :market, :name, :alias, :full_name, :venue, :records, :player_stats, :team_stats, :seed
            
                    def initialize(data, **opts)
                      @response = data
            Severity: Minor
            Found in lib/sportradar/api/basketball/team.rb - About 2 hrs to fix

              Class Tournament has 22 methods (exceeds 20 allowed). Consider refactoring.
              Open

                      class Tournament < Data
                        attr_accessor :response, :id, :name, :status, :location, :start, :end
              
                        def initialize(data, **opts)
                          # @response = data
              Severity: Minor
              Found in lib/sportradar/api/basketball/ncaamb/tournament.rb - About 2 hrs to fix

                Class Team has 22 methods (exceeds 20 allowed). Consider refactoring.
                Open

                      class Team < Data
                        attr_accessor :response, :id, :market, :name, :alias, :full_name, :venue, :records, :player_stats, :team_stats
                
                        def initialize(data, **opts)
                          @response = data # comment this out when done developing
                Severity: Minor
                Found in lib/sportradar/api/baseball/team.rb - About 2 hrs to fix

                  Class Base has 21 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                          class Base < Data
                            attr_accessor :response, :id, :clock, :event_type, :description, :statistics, :score, :team_id, :player_id, :quarter, :half, :updated, :location, :possession, :on_court, :on_court_ids, :game_seconds, :identifier
                            alias :type :event_type
                  
                            def initialize(data, **opts)
                  Severity: Minor
                  Found in lib/sportradar/api/basketball/plays/base.rb - About 2 hrs to fix

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

                            def update(data, **opts)
                              @name         = data['name']          if data['name']
                              @abbreviation = data['abbreviation']  if data['abbreviation']
                              @short_name   = data['short_name']    if data['short_name']
                    
                    
                    Severity: Minor
                    Found in lib/sportradar/api/mma/fighter.rb - About 2 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

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

                            def update(data, **opts)
                              handle_names(data)
                              @id = data['id'] || @id
                    
                              @venue    = Venue.new(data['venue']) if data['venue']
                    Severity: Minor
                    Found in lib/sportradar/api/football/team.rb - About 2 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

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

                            def update(data, **opts)
                              @status           = data['status']            if data['status']
                              @preferred_name   = data['preferred_name']  || data['name_preferred'] || @preferred_name
                              @name_full        = data['name_full']       || data['name']           || @name_full
                              @name_first       = data['name_first']      || data['first_name']     || @name_first
                    Severity: Minor
                    Found in lib/sportradar/api/football/player.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 a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                              def update(data, **opts)
                                @status           = data['status']            if data['status']            # "ACT",
                                @full_name        = data['full_name']         if data['full_name']         # "Festus Ezeli",
                                @first_name       = data['first_name']        if data['first_name']        # "Festus",
                                @last_name        = data['last_name']         if data['last_name']         # "Ezeli",
                    Severity: Minor
                    Found in lib/sportradar/api/basketball/ncaamb/player.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

                    Severity
                    Category
                    Status
                    Source
                    Language