arosenfeld/cows

View on GitHub

Showing 3 of 3 total issues

Function items has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def items(self, extract_values=False):
        """Gets all items in the trie.

        Yields:
            ``(node_key, node)`` pairs of all items.
Severity: Minor
Found in cows/trie.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 children_matching has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def children_matching(self, prefix):
        """Gets all child nodes matching the single character prefix.  If the
        character is a wildcard, it will return all children and if a wildcard
        is included in the children, it will be included.

Severity: Minor
Found in cows/trie.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 get_matches has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def get_matches(self, key):
        """Searches the trie for strings matching ``key``.

        Example:
            If the trie contains ``ABCD``, ``ABCA``, and ``CBC*``, the
Severity: Minor
Found in cows/trie.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

Severity
Category
Status
Source
Language