beneggett/sportradar-api

View on GitHub

Showing 185 of 185 total issues

Method update has a Cognitive Complexity of 25 (exceeds 5 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 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

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

        def update(data, **opts)
          @id     = data['id'] if data['id']

          if data['league']
            @id    = data.dig('league', 'id')
Severity: Major
Found in lib/sportradar/api/basketball/ncaamb.rb and 1 other location - About 3 hrs to fix
lib/sportradar/api/basketball/nba.rb on lines 26..46

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

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 update(data, **opts)
          @id     = data['id'] if data['id']

          if data['league']
            @id    = data.dig('league', 'id')
Severity: Major
Found in lib/sportradar/api/basketball/nba.rb and 1 other location - About 3 hrs to fix
lib/sportradar/api/basketball/ncaamb.rb on lines 26..46

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

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

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

          module Api
            module Mma
              class Referee < Data
                attr_accessor :response, :id, :first_name, :last_name
                @all_hash = {}
        Severity: Major
        Found in lib/sportradar/api/mma/referee.rb and 1 other location - About 3 hrs to fix
        lib/sportradar/api/mma/judge.rb on lines 2..49

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

        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

          module Api
            module Mma
              class Judge < Data
                attr_accessor :response, :id, :first_name, :last_name
                @all_hash = {}
        Severity: Major
        Found in lib/sportradar/api/mma/judge.rb and 1 other location - About 3 hrs to fix
        lib/sportradar/api/mma/referee.rb on lines 2..49

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

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

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

            module Api
              module Basketball
                class Nba
                  class Quarter < Data
                    attr_accessor :response, :id, :game, :number, :sequence, :home_points, :away_points, :drives
          Severity: Major
          Found in lib/sportradar/api/basketball/nba/quarter.rb and 1 other location - About 2 hrs to fix
          lib/sportradar/api/basketball/ncaamb/half.rb on lines 2..52

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

          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

            module Api
              module Basketball
                class Ncaamb
                  class Half < Data
                    attr_accessor :response, :id, :game, :number, :sequence, :home_points, :away_points, :drives
          Severity: Major
          Found in lib/sportradar/api/basketball/ncaamb/half.rb and 1 other location - About 2 hrs to fix
          lib/sportradar/api/basketball/nba/quarter.rb on lines 2..52

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

          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 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 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, :seed
              
                      def initialize(data, **opts)
                        @response = data
              Severity: Minor
              Found in lib/sportradar/api/basketball/team.rb - About 2 hrs to fix
                Severity
                Category
                Status
                Source
                Language