neilisaac/lazycontract

View on GitHub

Showing 4 of 15 total issues

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

    def __discover_properties(self, obj, cls):
        for name, inst in six.iteritems(cls.__dict__):
            if isinstance(inst, LazyProperty):
                self._properties[name] = inst

Severity: Minor
Found in lazycontract/contract.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 _populate_properties has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def _populate_properties(self, obj):
        for key, value in six.iteritems(obj):
            if key in self._mappings:
                key = self._mappings[key]

Severity: Minor
Found in lazycontract/contract.py - About 1 hr 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 _populate_properties has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def _populate_properties(self, obj):
        contained = {k: v for k, v in six.iteritems(obj) \
                     if k in self._properties or k in self._mappings}
        super(DynamicContract, self)._populate_properties(contained)

Severity: Minor
Found in lazycontract/contract.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 __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(self, name=None, default=None,
Severity: Minor
Found in lazycontract/contract.py - About 35 mins to fix
    Severity
    Category
    Status
    Source
    Language