beneggett/sportradar-api

View on GitHub

Showing 102 of 185 total issues

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 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def update(data, **opts)
          if data["sport_event"]
            update(data["sport_event"])
          end
          if data["sport_event_status"]
Severity: Minor
Found in lib/sportradar/api/soccer/match.rb - About 1 hr to fix

    Method subclasses has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def self.subclasses
              @subclasses ||= {
                "opentip"               => OpenTip,
                "twopointmiss"          => TwoPointMiss,
                "rebound"               => Rebound,
    Severity: Minor
    Found in lib/sportradar/api/basketball/play.rb - About 1 hr to fix

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

              def update(data, **opts)
                @api              = opts[:api] || @api
                @drive            = opts[:drive] || @drive
                @description      = data["description"] || data['summary'] || @description
                @alt_description  = data['alt_description'] if data['alt_description']
      Severity: Minor
      Found in lib/sportradar/api/football/play.rb - About 1 hr to fix

        Method runner_outcomes has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def runner_outcomes
                  @runner_outcomes ||= {
                    'CK'     => 'Checked',
                    'ERN'    => 'Earned Run/RBI',
                    'eRN'    => 'Earned Run/No RBI',
        Severity: Minor
        Found in lib/sportradar/api/baseball/runner.rb - About 1 hr to fix

          Method set_game_stats has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def set_game_stats(data)
                    @game_stats ||= {}
          
                    @game_stats[:substituted_in] = data['substituted_in'] if data['substituted_in'].present?
                    @game_stats[:substituted_out] = data['substituted_out'] if data['substituted_out'].present?
          Severity: Minor
          Found in lib/sportradar/api/soccer/player.rb - About 1 hr to fix

            Method api_key has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                  def api_key
                    if league
            
                      if access_level == 'p'
                        Sportradar::Api.api_key_params("images_#{league}", "production")
            Severity: Minor
            Found in lib/sportradar/api/images.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 player_manifests has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                  def player_manifests(year = Date.today.year)
                    if league
                      if year != Date.today.year
                        response = get request_url("#{league}/#{image_type}/players/#{year}/manifest")
                      else
            Severity: Minor
            Found in lib/sportradar/api/images.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_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 a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                    def update(data, **opts)
                      @id     = data['id'] if data['id']
            
                      if data['league']
                        @id    = data.dig('league', 'id')
            Severity: Minor
            Found in lib/sportradar/api/basketball/nba.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 12 (exceeds 5 allowed). Consider refactoring.
            Open

                    def update(data, **opts)
                      @id     = data['id'] if data['id']
            
                      if data['league']
                        @id    = data.dig('league', 'id')
            Severity: Minor
            Found in lib/sportradar/api/basketball/ncaamb.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 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    def update(data, **opts)
                      @depth            = data['depth']             if data['depth']
                      @experience       = data['experience']        if data['experience']
                      @birth_place      = data['birth_place'].gsub(',,', ', ')       if data['birth_place']
                      @college          = data['college']           if data['college']
            Severity: Minor
            Found in lib/sportradar/api/baseball/player.rb - About 1 hr to fix

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

                      def update(data, source: nil, **opts)
                        @response.merge!(data)
                        # via pbp
                        @status       = data['status']                if data['status']
                        @coverage     = data['coverage']              if data['coverage']
              Severity: Minor
              Found in lib/sportradar/api/baseball/game.rb - About 1 hr to fix

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

                        def update(data, **opts)
                
                          if data['outcome_id']
                            @outcome_id   = data['outcome_id']
                            @outcome      = self.class.pitch_outcome(@outcome_id)
                Severity: Minor
                Found in lib/sportradar/api/baseball/pitch.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 11 (exceeds 5 allowed). Consider refactoring.
                Open

                        def update(data, **opts)
                          handle_names(data)
                          @venue    = Venue.new(data['venue']) if data['venue']
                
                          @seed     = data['seed'].to_i             if data['seed']
                Severity: Minor
                Found in lib/sportradar/api/basketball/team.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 11 (exceeds 5 allowed). Consider refactoring.
                Open

                        def update(data, source: nil, **opts)
                          # update stuff
                          @id       = data.dig('league', 'id')    if data.dig('league', 'id')
                          @name     = data.dig('league', 'name')  if data.dig('league', 'name')
                          @alias    = data.dig('league', 'alias') if data.dig('league', 'alias')
                Severity: Minor
                Found in lib/sportradar/api/baseball/mlb.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 11 (exceeds 5 allowed). Consider refactoring.
                Open

                        def update(data, **opts)
                          @type                 = data['type']                  if data['type']
                          @odds_decimal         = data['odds_decimal']          if data['odds_decimal']
                          @odds_american        = data['odds_american']         if data['odds_american']
                          @odds_fraction        = data['odds_fraction']         if data['odds_fraction']
                Severity: Minor
                Found in lib/sportradar/api/odds/outcome.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 30 lines of code (exceeds 25 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 1 hr to fix

                  Method update has 30 lines of code (exceeds 25 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

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