Showing 105 of 336 total issues
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 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 do_settlement_public_order_update
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def do_settlement_public_order_update(settlement: Settlement):
hunger_percent = settlement.get_hunger_percentage()
if hunger_percent > 20:
settlement.public_order -= (hunger_percent - 20) * 5
elif hunger_percent < 10:
- 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"