shmilylty/OneForAll

View on GitHub
common/tablib/tablib.py

Summary

Maintainability
C
7 hrs
Test Coverage

Function _package has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    def _package(self, dicts=True, ordered=True):
        """Packages Dataset into lists of dictionaries for transmission."""
        # TODO: Dicts default to false?

        _data = list(self._data)
Severity: Minor
Found in common/tablib/tablib.py - About 3 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 _validate has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def _validate(self, row=None, col=None, safety=False):
        """Assures size of every row in dataset is of proper proportions."""
        if row:
            is_valid = (len(row) == self.width) if self.width else True
        elif col:
Severity: Minor
Found in common/tablib/tablib.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

Avoid deeply nested control flow statements.
Open

                            for j, c in enumerate(row):
                                _data[row_i][j] = callback(c)
                        else:
Severity: Major
Found in common/tablib/tablib.py - About 45 mins to fix

    Function _set_dict has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def _set_dict(self, pickle):
            """A native Python representation of the Dataset object. If headers have been
            set, a list of Python dictionaries will be returned. If no headers have been
            set, a list of tuples (rows) will be returned instead.
    
    
    Severity: Minor
    Found in common/tablib/tablib.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

    There are no issues that match your filters.

    Category
    Status