svthalia/concrexit

View on GitHub
website/activemembers/models.py

Summary

Maintainability
B
6 hrs
Test Coverage

File models.py has 337 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""The models defined by the activemembers package."""

import datetime
import logging

Severity: Minor
Found in website/activemembers/models.py - About 4 hrs to fix

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

    def validate_unique(self, **kwargs):
        try:
            super().validate_unique(**kwargs)
            # Skip checks if group hasn't been saved yet.
            if self.group.id is not None:
Severity: Minor
Found in website/activemembers/models.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 clean has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def clean(self):
        try:
            if self.until and (not self.since or self.until < self.since):
                raise ValidationError(
                    {"until": _("End date can't be before start date")}
Severity: Minor
Found in website/activemembers/models.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 get_absolute_url has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def get_absolute_url(self):
        try:
            return self.board.get_absolute_url()
        except self.DoesNotExist:
            try:
Severity: Minor
Found in website/activemembers/models.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

There are no issues that match your filters.

Category
Status