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
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
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?
- Read upRead up
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
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?
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
- Read upRead up
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)
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?
- Read upRead up
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|
- Read upRead up
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
- Read upRead up
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"))
- Read upRead up
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"