jardiacaj/finem_imperii

View on GitHub

Showing 105 of 336 total issues

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:
Severity: Minor
Found in turn/public_order.py - 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

Function capability_required_decorator has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def capability_required_decorator(func):
    @inchar_required
    def inner(*args, **kwargs):
        def fail_the_request(*args, **kwargs):
            messages.error(args[0], "You cannot do that", "danger")
Severity: Minor
Found in organization/views/decorator.py - 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

Function bureaucratic_work has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def bureaucratic_work(request):
    if not request.hero.can_do_bureaucratic_work():
        raise Http404("Can't do that")

    if request.method == "POST":
Severity: Minor
Found in character/views/actions.py - 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

Function get_hunger_display has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def get_hunger_display(self):
        return "satiated" if self.hunger <= 0 else \
            "hungry" if self.hunger == 1 else \
                "very hungry" if self.hunger in (2, 3) else \
                    "starving"
Severity: Minor
Found in world/models/npcs.py - 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

Function conquest_action has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def conquest_action(request, unit_id):
    unit = get_object_or_404(
        WorldUnit,
        id=unit_id,
        owner_character=request.hero
Severity: Minor
Found in unit/views/actions.py - 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