beneggett/sportradar-api

View on GitHub

Showing 185 of 185 total issues

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

      Identical blocks of code found in 2 locations. 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: Major
      Found in lib/sportradar/api/soccer/tournament.rb and 1 other location - About 1 hr to fix
      lib/sportradar/api/soccer/competition.rb on lines 226..256

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 55.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      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

      Identical blocks of code found in 2 locations. 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: Major
      Found in lib/sportradar/api/soccer/competition.rb and 1 other location - About 1 hr to fix
      lib/sportradar/api/soccer/tournament.rb on lines 235..265

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 55.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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 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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                    def initialize(data, **opts)
                      @response = data
                      @api      = opts[:api]
          
                      @id       = data.dig('league', 'id')
          Severity: Major
          Found in lib/sportradar/api/basketball/nba/season.rb and 1 other location - About 1 hr to fix
          lib/sportradar/api/basketball/ncaamb/season.rb on lines 8..22

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 53.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                    def initialize(data, **opts)
                      @response = data
                      @api      = opts[:api]
          
                      @id       = data.dig('league', 'id')
          Severity: Major
          Found in lib/sportradar/api/basketball/ncaamb/season.rb and 1 other location - About 1 hr to fix
          lib/sportradar/api/basketball/nba/season.rb on lines 8..23

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 53.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          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 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 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

              Severity
              Category
              Status
              Source
              Language