beneggett/sportradar-api

View on GitHub

Showing 185 of 185 total issues

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

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

              def update_bases(data)
                if data.is_a?(Sportradar::Api::Baseball::Error)
                  puts data.inspect
                  return
                end
      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 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

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

              def parse_from_box(data)
                id = data.dig('home', 'id')
                da = data.dig('home', 'scoring')
                return {} unless da
                da.each { |h| h[id] = h.delete('runs') }
      Severity: Major
      Found in lib/sportradar/api/baseball/outcome.rb and 1 other location - About 1 hr to fix
      lib/sportradar/api/baseball/scoring.rb on lines 67..76

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

      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

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

              def parse_from_box(data)
                id = data.dig('home', 'id')
                da = data.dig('home', 'scoring')
                return {} unless da
                da.each { |h| h[id] = h.delete('runs') }
      Severity: Major
      Found in lib/sportradar/api/baseball/scoring.rb and 1 other location - About 1 hr to fix
      lib/sportradar/api/baseball/outcome.rb on lines 43..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 73.

      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 parse_season(data)
                if data['season_coverage_info']
                  @season_coverage_info = data['season_coverage_info'] if data['season_coverage_info']
                  data['season_coverage_info']['id'] ||= data['season_coverage_info'].delete('season_id')
                  create_data(@seasons_hash, data['season_coverage_info'], klass: Season, api: api, tournament: self)
      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 104..114

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

      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 parse_season(data)
                if data['season_coverage_info']
                  @season_coverage_info = data['season_coverage_info'] if data['season_coverage_info']
                  data['season_coverage_info']['id'] ||= data['season_coverage_info'].delete('season_id')
                  create_data(@seasons_hash, data['season_coverage_info'], klass: Season, api: api, competition: self)
      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 89..99

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

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

                Severity
                Category
                Status
                Source
                Language