Hrabal/TemPy

View on GitHub
tempy/widgets/tempytable.py

Summary

Maintainability
B
6 hrs
Test Coverage

Function populate has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    def populate(self, data, resize_x=True, normalize=True):
        """Adds/Replace data in the table.
        data: an iterable of iterables in the form [[col1, col2, col3], [col1, col2, col3]]
        resize_x: if True, changes the x-size of the table according to the given data.
            If False and data have dimensions different from the existing table structure a WidgetDataError is raised.
Severity: Minor
Found in tempy/widgets/tempytable.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

TempyTable has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

class TempyTable(tags.Table):
    """Table widget.
    Creates a simple table structure using the give data, or an empty table of the given size.self
    params:
    data: an iterable of iterables in this form [[col1, col2, col3], [col1, col2, col3]]
Severity: Minor
Found in tempy/widgets/tempytable.py - About 2 hrs to fix

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

    def __init__(self, rows=0, cols=0, data=None, **kwargs):
        caption = kwargs.pop("caption", None)
        head = kwargs.pop("head", False)
        foot = kwargs.pop("foot", False)
        super().__init__(**kwargs)
Severity: Minor
Found in tempy/widgets/tempytable.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 map_col has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def map_col(self, col_function, col_index=None, ignore_errors=True):
        # applies function to every cell
        if col_index is None:
            self.map_table(col_function)
            return self
Severity: Minor
Found in tempy/widgets/tempytable.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