wyeworks/rubygoal

View on GitHub

Showing 11 of 11 total issues

Class Game has 22 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Game
    attr_reader :team_home, :team_away, :ball,
                :time, :goal, :recorder,
                :coach_home, :coach_away,
                :score_home, :score_away
Severity: Minor
Found in lib/rubygoal/game.rb - About 2 hrs to fix

    Method formation has 53 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def formation(match)
          formation = Formation.new
    
          if match.me.winning?
            formation.lineup do
    Severity: Major
    Found in lib/rubygoal/coaches/coach_definition_away.rb - About 2 hrs to fix

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

          def update(elapsed_time)
            match_data = match_data_factory.create
            self.formation = coach.formation(match_data)
      
            unless formation.valid?
      Severity: Minor
      Found in lib/rubygoal/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 formation has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def formation(match)
            formation = Formation.new
      
            if match.me.winning?
              formation.defenders :pereira, :cacerez, :gimenez, :godin, :rodriguez
      Severity: Minor
      Found in lib/rubygoal/coaches/coach_definition_home.rb - About 1 hr to fix

        Method update has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def update(elapsed_time)
              match_data = match_data_factory.create
              self.formation = coach.formation(match_data)
        
              unless formation.valid?
        Severity: Minor
        Found in lib/rubygoal/team.rb - About 1 hr to fix

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

              def formation(match)
                formation = Formation.new
          
                if match.me.winning?
                  formation.defenders :pereira, :cacerez, :gimenez, :godin, :rodriguez
          Severity: Minor
          Found in lib/rubygoal/coaches/coach_definition_home.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 initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def initialize(my_score, other_score, ball_position, my_positions, other_positions, time)
          Severity: Minor
          Found in lib/rubygoal/match_data.rb - About 45 mins to fix

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

                def update(elapsed_time)
                  self.elapsed_time = elapsed_time
            
                  if blocking_player
                    if close_to_destination? || any_moving_and_very_close_player?
            Severity: Minor
            Found in lib/rubygoal/players/player_movement.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

            Method nearest_forward_teammate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def nearest_forward_teammate(player)
                  min_dist = INFINITE
                  nearest_teammate = nil
            
                  (players.values - [player]).each do |teammate|
            Severity: Minor
            Found in lib/rubygoal/team.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

            Method formation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def formation(match)
                  formation = Formation.new
            
                  if match.me.winning?
                    formation.lineup do
            Severity: Minor
            Found in lib/rubygoal/coaches/coach_definition_away.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

            Method load_definition_coach has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def load_definition_coach
                  if filename && File.exists?(filename)
                    load filename
            
                    class_name = camelize(File.basename(filename, ".rb"))
            Severity: Minor
            Found in lib/rubygoal/coach_loader.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