c0fec0de/anytree

View on GitHub

Showing 12 of 25 total issues

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

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

    File render.py has 298 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

      Function by_attr has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def by_attr(self, attrname="name"):
              u"""
              Return rendered tree with node attribute `attrname`.
      
              >>> from anytree import AnyNode, RenderTree
      Severity: Minor
      Found in anytree/render.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 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 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 get has a Cognitive Complexity of 8 (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 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 _iter has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def _iter(children, filter_, stop, maxlevel):
                  if children:
                      assert len(children) == 1
                      _iter = LevelOrderGroupIter(children[0], filter_, stop, maxlevel)
                      while True:
          Severity: Minor
          Found in anytree/iterators/zigzaggroupiter.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 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 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_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 __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

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

                      def __item(node, continues, style):
                          if not continues:
                              return Row(u'', u'', node)
                          else:
                              items = [style.vertical if cont else style.empty for cont in continues]
                  Severity: Minor
                  Found in anytree/render.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