svthalia/concrexit

View on GitHub
website/thaliawebsite/settings.py

Summary

Maintainability
F
3 days
Test Coverage

File settings.py has 983 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Django settings for concrexit.

For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/

Severity: Major
Found in website/thaliawebsite/settings.py - About 2 days to fix

Function from_env has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

def from_env(
    name, *, production=_NOT_SET, staging=_NOT_SET, testing=_NOT_SET, development=None
):
    """Generate a setting that's overridable by the process environment.

Severity: Minor
Found in website/thaliawebsite/settings.py - About 2 hrs 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 setting has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def setting(*, development, production, staging=_NOT_SET, testing=_NOT_SET):
    """Generate a setting depending on the DJANGO_ENV and the arguments.

    This function is meant for static settings that depend on the DJANGO_ENV. If the
    staging or testing arguments are left to their defaults, they will fall back to
Severity: Minor
Found in website/thaliawebsite/settings.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 from_env has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

def from_env(
Severity: Minor
Found in website/thaliawebsite/settings.py - About 45 mins to fix

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

def setting(*, development, production, staging=_NOT_SET, testing=_NOT_SET):
Severity: Minor
Found in website/thaliawebsite/settings.py - About 35 mins to fix

Avoid too many return statements within this function.
Open

            return development
Severity: Major
Found in website/thaliawebsite/settings.py - About 30 mins to fix

Avoid too many return statements within this function.
Open

            return testing
Severity: Major
Found in website/thaliawebsite/settings.py - About 30 mins to fix

There are no issues that match your filters.

Category
Status