RLovelett/sports_data_api

View on GitHub

Showing 10 of 51 total issues

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

      def initialize(team_hash, conference = nil, division = nil, subdivision = nil)
        if team_hash
          @id = team_hash['id']
          @name = team_hash['name']
          @conference = conference
Severity: Minor
Found in lib/sports_data_api/ncaafb/team.rb - About 1 hr to fix

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

          def initialize(team_hash, conference = nil, division = nil, subdivision = nil)
            if team_hash
              @id = team_hash['id']
              @name = team_hash['name']
              @conference = conference
    Severity: Minor
    Found in lib/sports_data_api/ncaafb/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 initialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

          def initialize(args={})
            xml = args.fetch(:xml)
            @year = args[:year] ? args[:year].to_i : nil
            @season = args[:season] ? args[:season].to_sym : nil
            @date = args[:date]
    Severity: Minor
    Found in lib/sports_data_api/ncaamb/game.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 players_from_stats has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def players_from_stats
            statistics.each_with_object({}) do |(key, data), players|
              next unless data.is_a?(Hash)
              if key == EXTRA_POINTS_KEY
                data.each do |nested_key, nested_data|
    Severity: Minor
    Found in lib/sports_data_api/nfl/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 game_statistics has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def game_statistics(year, season, week, home, away)
    Severity: Minor
    Found in lib/sports_data_api/ncaafb.rb - About 35 mins to fix

      Method game_roster has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

            def game_roster(year, season, week, home, away)
      Severity: Minor
      Found in lib/sports_data_api/ncaafb.rb - About 35 mins to fix

        Method play_by_play has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

              def play_by_play(year, season, week, home, away)
        Severity: Minor
        Found in lib/sports_data_api/ncaafb.rb - About 35 mins to fix

          Method boxscore has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                def boxscore(year, season, week, home, away)
          Severity: Minor
          Found in lib/sports_data_api/ncaafb.rb - About 35 mins to fix

            Method parse_player_statistics has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                  def parse_player_statistics(stats_hash)
                    players = []
                    stats_hash.keys.each do |key|
                      next if !stats_hash[key]['players']
                      stats_hash[key]['players'].each do |p|
            Severity: Minor
            Found in lib/sports_data_api/ncaafb/team.rb - About 35 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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                  def initialize(args={})
                    xml = args.fetch(:xml)
                    @year = args[:year] ? args[:year].to_i : nil
                    @season = args[:season] ? args[:season].to_sym : nil
            
            
            Severity: Minor
            Found in lib/sports_data_api/ncaamb/tournament.rb - About 25 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