beneggett/sportradar-api

View on GitHub

Showing 102 of 185 total issues

Method update has 28 lines of code (exceeds 25 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 1 hr to fix

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

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

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

              def handle_names(data)
                # need to do some more work here
                @name = data['name'] if data['name']
                if data['name'] && !data.key?('market')
                  @full_name = data['name']
    Severity: Minor
    Found in lib/sportradar/api/basketball/nba/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 advance_inning has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

            def advance_inning
              @inning_over = false
              return unless count['outs'] == 3
              if count['inning'] >= 9
                if count['inning_half'] == 'T' && leading_team_id == home.id
    Severity: Minor
    Found in lib/sportradar/api/baseball/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_teams has a Cognitive Complexity of 10 (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/nfl/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 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 end_reason_possibilities has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def end_reason_possibilities
              [
                'UNKNOWN',
                'Touchdown',
                'Safety',
    Severity: Minor
    Found in lib/sportradar/api/football/drive.rb - About 1 hr to fix

      Method initialize has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def initialize(data)
                @response       = data
                @id             = data["id"]
                @type           = data["type"]
                @time           = data["time"]
      Severity: Minor
      Found in lib/sportradar/api/soccer/fact.rb - About 1 hr to fix

        Method update has 26 lines of code (exceeds 25 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 1 hr to fix

          Method tournament_ids has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def self.tournament_ids
                    @tournament_ids ||= {
                      # Europe group
                      'eu.uefa_champions_league'  => "sr:tournament:7",
                      'eu.la_liga'                => "sr:tournament:8",
          Severity: Minor
          Found in lib/sportradar/api/soccer/competition.rb - About 1 hr to fix

            Method tournament_ids has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    def self.tournament_ids
                      @tournament_ids ||= {
                        # Europe group
                        'eu.uefa_champions_league'  => "sr:tournament:7",
                        'eu.la_liga'                => "sr:tournament:8",
            Severity: Minor
            Found in lib/sportradar/api/soccer/tournament.rb - About 1 hr to fix

              Method parse_description_for_drive_end has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                        def parse_description_for_drive_end
                          parsed_ending = case @description
                          when /no play/i
                            nil
                          when /intercepted/i
              Severity: Minor
              Found in lib/sportradar/api/football/ncaafb/play.rb - About 1 hr to fix

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

                          def update(data, **opts)
                
                            @season = opts[:season] if opts[:season]
                
                            @status   = data['status']                  if data['status']
                Severity: Minor
                Found in lib/sportradar/api/basketball/ncaamb/tournament.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 next_batters has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                        def next_batters(team, number_of_upcoming_batters = 3)
                          if team == 'home'
                            last_at_bat = game.at_bats.select{|at_bat| at_bat.event.half_inning.half == 'B'}.last
                            if last_at_bat
                              last_position = @home.detect{|htl| htl['id'] == last_at_bat.hitter_id}&.dig('order')
                Severity: Minor
                Found in lib/sportradar/api/baseball/lineup.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 update has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                        def update(data, **opts)
                          @round       = data['round']       if data['round']       # "3",
                          @time        = data['time']        if data['time']        # "05:00",
                          @outcome     = data['method']      if data['method']      # "Decision - Split",
                          @submission  = data['submission']  if data['submission']  # "",
                Severity: Minor
                Found in lib/sportradar/api/mma/result.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 parse_flags has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                        def parse_flags(data)
                          @is_ab_over     = data['is_ab_over']       if data['is_ab_over']
                          @is_bunt        = data['is_bunt']          if data['is_bunt']
                          @is_bunt_shown  = data['is_bunt_shown']    if data['is_bunt_shown']
                          @is_hit         = data['is_hit']           if data['is_hit']
                Severity: Minor
                Found in lib/sportradar/api/baseball/pitch.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 update has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                        def update(data, **opts)
                          handle_names(data)
                          @venue    = Venue.new(data['venue']) if data['venue']
                
                          @alias    = data['abbr']                if data['abbr']
                Severity: Minor
                Found in lib/sportradar/api/baseball/team.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 event_manifests has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                      def event_manifests
                        # /[league]/[image_type]/events/[year]/[month]/[day]/manifest.[format]?api_key={your_api_key}
                        raise Sportradar::Api::Error::InvalidType unless date.present? || event_id.present?
                        @live_image_request = true
                        if event_id.present?
                Severity: Minor
                Found in lib/sportradar/api/images.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 parse_statistics has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                          def parse_statistics(data)
                            return unless data['statistics']
                            @statistics = data['statistics']
                            stat = @statistics.detect { |hash| hash['type'] == base_key }
                            # stat = data.dig('statistics', base_key) rescue data.dig('statistics', 0, base_key)
                Severity: Minor
                Found in lib/sportradar/api/basketball/plays/base.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

                Severity
                Category
                Status
                Source
                Language