Showing 105 of 336 total issues
Avoid too many return
statements within this function. Open
return render(request, 'account/register.html')
Avoid too many return
statements within this function. Open
if ( state !== STATE.TOUCH_DOLLY ) return; // is this needed?...
Avoid too many return
statements within this function. Open
return capability_success(capability, request)
Avoid too many return
statements within this function. Open
if ( scope.enablePan === false ) return;
Avoid too many return
statements within this function. Open
return redirect(character.activation_url)
Avoid too many return
statements within this function. Open
return result
Avoid too many return
statements within this function. Open
return result
Function create_unit
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create_unit(name, owner, location, soldiers, recruitment_type, unit_type):
orders = Order.objects.create(what=Order.STAND)
unit = WorldUnit.objects.create(
owner_character=owner,
- 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 check_if_order_done
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def check_if_order_done(battle_unit_in_turn: BattleUnitInTurn):
order = battle_unit_in_turn.battle_unit.get_order()
if order:
if order.what == Order.MOVE:
if euclidean_distance(battle_unit_in_turn.coordinates(), order.target_location_coordinates()) == 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 opponents_in_organization_list
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def opponents_in_organization_list(organizations, tile):
potential_conflicts = []
input_list = list(organizations)
while len(input_list):
- 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 coordinate_neighbours
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def coordinate_neighbours(coord: Coordinates):
result = []
for dx in (-1, 0, 1):
for dz in (-1, 0, 1):
if not dx == dz == 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 unit_breaker
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def unit_breaker(value, units):
unit = units[0]
unit_amount = value // unit.multiplier
rest = value % unit.multiplier
suffix = ''
- 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 present_candidacy_capability_view
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def present_candidacy_capability_view(request, capability_id):
capability = get_object_or_404(
Capability, id=capability_id, type=Capability.CANDIDACY)
election = capability.applying_to.current_election
- 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 military_stance_capability_context
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def military_stance_capability_context(request, capability, context):
if capability.applying_to.violence_monopoly:
context['states'] = []
for state in capability.applying_to.world.get_violence_monopolies():
if state == capability.applying_to:
- 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 unit_attack_melee
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def unit_attack_melee(contubernium: BattleContuberniumInTurn,
target_contubernium: BattleContuberniumInTurn):
for soldier in contubernium.battlesoldierinturn_set.all():
target_soldier = random.choice(
target_contubernium.battlesoldierinturn_set.all()[:]
- 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 diplomacy_capability_context
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def diplomacy_capability_context(request, capability, context):
if capability.applying_to.violence_monopoly:
context['states'] = []
for state in capability.applying_to.world.get_violence_monopolies():
if state == capability.applying_to:
- 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"
Further reading
Function ability_roll
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def ability_roll(self):
if self.wound_status == BattleSoldierInTurn.MEDIUM_WOUND:
if random.getrandbits(3) == 0:
self.able = False
self.save()
- 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 conquest_capability_view
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def conquest_capability_view(request, capability_id):
capability = get_object_or_404(
Capability, id=capability_id, type=Capability.CONQUEST)
tile_to_conquer = get_object_or_404(
Tile,id=request.POST.get('tile_to_conquest_id'))
- 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 build_population_query_from_request
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def build_population_query_from_request(request, location):
args = {}
for arg_name, arg_type in flag_types.items():
arg = []
for arg_element in arg_type:
- 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"