svthalia/concrexit

View on GitHub
website/sales/models/order.py

Summary

Maintainability
A
2 hrs
Test Coverage

Function save has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def save(
        self, force_insert=False, force_update=False, using=None, update_fields=None
    ):
        if self.shift.locked and (
            self._total_amount != 0 or (self._total_amount == 0 and not self._is_free)
Severity: Minor
Found in website/sales/models/order.py - About 55 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 save has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def save(
        self, force_insert=False, force_update=False, using=None, update_fields=None
    ):
        if self.order.shift.locked:
            raise ValueError("The shift this order belongs to is locked.")
Severity: Minor
Found in website/sales/models/order.py - About 45 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 save has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def save(
Severity: Minor
Found in website/sales/models/order.py - About 35 mins to fix

Function save has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def save(
Severity: Minor
Found in website/sales/models/order.py - About 35 mins to fix

There are no issues that match your filters.

Category
Status