c0fec0de/anytree

View on GitHub

Showing 17 of 35 total issues

File dotexporter.py has 362 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import codecs
import itertools
import logging
import re
from os import path, remove
Severity: Minor
Found in anytree/exporter/dotexporter.py - About 4 hrs to fix

    File render.py has 304 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    """
    Tree Rendering.
    
    * :any:`RenderTree` using the following styles:
    Severity: Minor
    Found in anytree/render.py - About 3 hrs to fix

      File resolver.py has 287 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      
      
      from __future__ import print_function
      
      
      Severity: Minor
      Found in anytree/resolver.py - About 2 hrs to fix

        Function get has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            def get(self, node, path):
                """
                Return instance at `path`.
        
                An example module tree:
        Severity: Minor
        Found in anytree/resolver.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 __start has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def __start(self, node, path, cmp_):
                sep = node.separator
                parts = path.split(sep)
                # resolve root
                if path.startswith(sep):
        Severity: Minor
        Found in anytree/resolver.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 __init__ has 9 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(
        Severity: Major
        Found in anytree/exporter/mermaidexporter.py - About 1 hr to fix

          Function _iter has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def _iter(children, filter_, stop, maxlevel):
                  if children:
                      if ASSERTIONS:  # pragma: no branch
                          assert len(children) == 1
                      _iter = LevelOrderGroupIter(children[0], filter_, stop, maxlevel)
          Severity: Minor
          Found in anytree/iterators/zigzaggroupiter.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 by_attr has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def by_attr(self, attrname="name"):
                  """
                  Return rendered tree with node attribute `attrname`.
          
                  >>> from anytree import AnyNode, RenderTree
          Severity: Minor
          Found in anytree/render.py - About 55 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 findall has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def findall(node, filter_=None, stop=None, maxlevel=None, mincount=None, maxcount=None):
          Severity: Minor
          Found in anytree/cachedsearch.py - About 45 mins to fix

            Function findall has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def findall(node, filter_=None, stop=None, maxlevel=None, mincount=None, maxcount=None):
            Severity: Minor
            Found in anytree/search.py - About 45 mins to fix

              Function findall_by_attr has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def findall_by_attr(node, value, name="name", maxlevel=None, mincount=None, maxcount=None):
              Severity: Minor
              Found in anytree/search.py - About 45 mins to fix

                Function findall_by_attr has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def findall_by_attr(node, value, name="name", maxlevel=None, mincount=None, maxcount=None):
                Severity: Minor
                Found in anytree/cachedsearch.py - About 45 mins to fix

                  Function _findall has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def _findall(node, filter_, stop=None, maxlevel=None, mincount=None, maxcount=None):
                  Severity: Minor
                  Found in anytree/search.py - About 45 mins to fix

                    Function __iter has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def __iter(self, indent, nodenamefunc, nodeattrfunc, edgeattrfunc, edgetypefunc):
                    Severity: Minor
                    Found in anytree/exporter/dotexporter.py - About 35 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                  return matches
                      Severity: Major
                      Found in anytree/resolver.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                return matches
                        Severity: Major
                        Found in anytree/resolver.py - About 30 mins to fix

                          Function walk has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def walk(start, end):
                                  """
                                  Walk from `start` node to `end` node.
                          
                                  Returns:
                          Severity: Minor
                          Found in anytree/walker.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