Function output_formation
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def output_formation(self):
widest_main_line_width = max([line.width for line in self.main_lines])
full_size_of_line = (self.formation_object.element_size +
self.formation_object.spacing)
flanks_x_offset = round(widest_main_line_width / 2) + \
- 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
File battle_init.py
has 328 lines of code (exceeds 250 allowed). Consider refactoring. Open
import math
from django.db import transaction
from django.db.models.aggregates import Avg
Function make_formation
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def make_formation(self):
for line_index in range(5):
for side_index in [0, 1, -1, 2, -2, 3, -3]:
units = self.get_battle_units_by_battle_settings(
line_index, side_index
- 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
Function generate_in_turn_objects
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def generate_in_turn_objects(battle):
turn = BattleTurn.objects.create(
battle=battle,
num=0
)
- 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
Function initialize_from_conflict
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def initialize_from_conflict(battle, conflict, tile):
for i, conflict_side in enumerate(conflict):
battle_side = BattleSide.objects.create(
battle=battle,
z=i
- 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
Function add_unit_to_battle_in_progress
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def add_unit_to_battle_in_progress(
battle_organization: BattleOrganization,
world_unit: WorldUnit
):
battle = battle_organization.side.battle
- 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
Function initialize_side_positioning
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def initialize_side_positioning(side: BattleSide):
formation_settings = side.get_formation()
if formation_settings.formation == BattleFormation.LINE:
formation = LineFormation(side, formation_settings)
else:
- 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
Function joining_contubernium_position_generator
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def joining_contubernium_position_generator():
for z in range(30, 48):
for x in range(20):
for multiplier in (-1, 1):
yield Coordinates(x=x*multiplier, z=z)
- 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"