sonntagsgesicht/mitschreiben

View on GitHub

Showing 9 of 22 total issues

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

    def to_tables(self):
        """Makes a table from each level within the DictTree and returns those tables stored in a new DictTree"""
        max_level = max(list(map(len, list(self.keys()))))
        tables = DictTree()
        for i in range(0, max_level):
Severity: Minor
Found in mitschreiben/formatting.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 __call__ has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

        def __call__(self, function):
            if not isinstance(function, type(lambda x: x)):
                msg = "This Decorator can only be applied to functions. You tried to decorate {}. Changing order of " \
                      "Decorators might resolve the problem".format(type(function))
                raise TypeError(msg)
Severity: Minor
Found in mitschreiben/recording.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 as_html_tree_table has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def as_html_tree_table(self, filename, path=None):
        """This function creates a html file, that is structured like a tree, where the last two-level-deep branches
        are represented as tables"""

        tree = self.to_tables()
Severity: Minor
Found in mitschreiben/formatting.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 as_tree_to_html has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def as_tree_to_html(self, filename, path=None):
        """This function creates a html file that presents the dicttree in its tree structure."""

        target_file_path = DictTree._make_target_filename(filename, path)

Severity: Minor
Found in mitschreiben/formatting.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 pretty_string has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def pretty_string(self, leftUpper=None, tabName=None, separator=" | "):
        representation = []
        name = tabName if tabName is not None else self.name
        if name is not None:
            representation.append(name)
Severity: Minor
Found in mitschreiben/table.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

                        if b.rows_count == 1:
                            b = b.transpose()
                        tables[key+("table",)]= b
Severity: Major
Found in mitschreiben/formatting.py - About 45 mins to fix

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

        def pretty_print(self):
            "this function prints an alphabetically sorted tree in a directory-like structure."
    
            def compare_keys(tpl_prev, tpl_next):
    
    
    Severity: Minor
    Found in mitschreiben/formatting.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 __getitem__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def __getitem__(self, tpl):
            if not isinstance(tpl, tuple):
                tpl = (tpl,)
            if tpl in list(self.keys()):
                return super(DictTree, self).__getitem__(tpl)
    Severity: Minor
    Found in mitschreiben/formatting.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 to_csv_files has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def to_csv_files(self, path):
            "this function creates csv files for every table that can be made from the tree"
    
            def make_filename(tabname):
                timestamp = datetime.datetime.now().strftime("%Y%m%d")
    Severity: Minor
    Found in mitschreiben/formatting.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

    Severity
    Category
    Status
    Source
    Language