um-cseg/chez-betty

View on GitHub
chezbetty/models/history_meta.py

Summary

Maintainability
C
1 day
Test Coverage

Function create_version has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

def create_version(obj, session, deleted=False):
    obj_mapper = object_mapper(obj)
    history_mapper = obj.__history_mapper__
    history_cls = history_mapper.class_

Severity: Minor
Found in chezbetty/models/history_meta.py - About 6 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 _history_mapper has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

def _history_mapper(local_mapper):
    cls = local_mapper.class_

    # set the "active_history" flag
    # on on column-mapped attributes so that the old version
Severity: Minor
Found in chezbetty/models/history_meta.py - About 4 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

Avoid deeply nested control flow statements.
Open

                    if p.foreign_keys:
                        obj_changed = True
                        break
                if obj_changed is True:
Severity: Major
Found in chezbetty/models/history_meta.py - About 45 mins to fix

    There are no issues that match your filters.

    Category
    Status