eventoL/eventoL

View on GitHub
eventol/manager/security.py

Summary

Maintainability
A
1 hr
Test Coverage
F
34%

Function user_passes_test has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def user_passes_test(test_func, name_redirect):
    """
    Decorator for views that checks that the user passes the given test,
    redirecting to the log-in page if necessary. The test should be a callable
    that takes the user object and returns True if the user passes.
Severity: Minor
Found in eventol/manager/security.py - About 35 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 create_permission_group has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def create_permission_group(name, code_names):
    group = Group.objects.filter(name__iexact=name).first()
    if group is None:
        group = Group.objects.create(name=name)
        for permission_codename in code_names:
Severity: Minor
Found in eventol/manager/security.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