hackedteam/vector-edk

View on GitHub
AppPkg/Applications/Python/Python-2.7.2/Lib/xml/dom/minidom.py

Summary

Maintainability
F
5 mos
Test Coverage

File minidom.py has 1515 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""\
minidom.py -- a lightweight DOM implementation.

parse("foo.xml")
Severity: Major
Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xml/dom/minidom.py - About 4 days to fix

    Function getElementById has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
    Open

        def getElementById(self, id):
            if id in self._id_cache:
                return self._id_cache[id]
            if not (self._elem_info or self._magic_id_count):
                return None
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xml/dom/minidom.py - About 1 day 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 _clone_node has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
    Open

    def _clone_node(node, deep, newOwnerDocument):
        """
        Clone a node and give it the new owner document.
        Called by Node.cloneNode and Document.importNode
        """
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xml/dom/minidom.py - About 6 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

    Document has 33 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Document(Node, DocumentLS):
        _child_node_types = (Node.ELEMENT_NODE, Node.PROCESSING_INSTRUCTION_NODE,
                             Node.COMMENT_NODE, Node.DOCUMENT_TYPE_NODE)
    
        nodeType = Node.DOCUMENT_NODE
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xml/dom/minidom.py - About 4 hrs to fix

      Function renameNode has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

          def renameNode(self, n, namespaceURI, name):
              if n.ownerDocument is not self:
                  raise xml.dom.WrongDocumentErr(
                      "cannot rename nodes from other documents;\n"
                      "expected %s,\nfound %s" % (self, n.ownerDocument))
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xml/dom/minidom.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

      Function normalize has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

          def normalize(self):
              L = []
              for child in self.childNodes:
                  if child.nodeType == Node.TEXT_NODE:
                      if not child.data:
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xml/dom/minidom.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

      Element has 25 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Element(Node):
          nodeType = Node.ELEMENT_NODE
          nodeValue = None
          schemaType = _no_type
      
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xml/dom/minidom.py - About 2 hrs to fix

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

        class NamedNodeMap(object):
            """The attribute list is a transient interface to the underlying
            dictionaries.  Mutations here will change the underlying element's
            dictionary.
        
        Severity: Minor
        Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xml/dom/minidom.py - About 2 hrs to fix

          Node has 21 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Node(xml.dom.Node):
              namespaceURI = None # this is non-null only for elements and attributes
              parentNode = None
              ownerDocument = None
              nextSibling = None
          Severity: Minor
          Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xml/dom/minidom.py - About 2 hrs to fix

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

                def insertBefore(self, newChild, refChild):
                    if newChild.nodeType == self.DOCUMENT_FRAGMENT_NODE:
                        for c in tuple(newChild.childNodes):
                            self.insertBefore(c, refChild)
                        ### The DOM does not clearly specify what to return in this case
            Severity: Minor
            Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xml/dom/minidom.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 createDocument has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                def createDocument(self, namespaceURI, qualifiedName, doctype):
                    if doctype and doctype.parentNode is not None:
                        raise xml.dom.WrongDocumentErr(
                            "doctype object owned by another DOM tree")
                    doc = self._create_document()
            Severity: Minor
            Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xml/dom/minidom.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 replaceWholeText has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                def replaceWholeText(self, content):
                    # XXX This needs to be seriously changed if minidom ever
                    # supports EntityReference nodes.
                    parent = self.parentNode
                    n = self.previousSibling
            Severity: Minor
            Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xml/dom/minidom.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 _get_elements_by_tagName_ns_helper has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            def _get_elements_by_tagName_ns_helper(parent, nsURI, localName, rc):
                for node in parent.childNodes:
                    if node.nodeType == Node.ELEMENT_NODE:
                        if ((localName == "*" or node.localName == localName) and
                            (nsURI == "*" or node.namespaceURI == nsURI)):
            Severity: Minor
            Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xml/dom/minidom.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 cloneNode has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                def cloneNode(self, deep):
                    if self.ownerDocument is None:
                        # it's ok
                        clone = DocumentType(None)
                        clone.name = self.name
            Severity: Minor
            Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xml/dom/minidom.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 replaceChild has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def replaceChild(self, newChild, oldChild):
                    if newChild.nodeType == self.DOCUMENT_FRAGMENT_NODE:
                        refChild = oldChild.nextSibling
                        self.removeChild(oldChild)
                        return self.insertBefore(newChild, refChild)
            Severity: Minor
            Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xml/dom/minidom.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 setAttributeNS has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def setAttributeNS(self, namespaceURI, qualifiedName, value):
                    prefix, localname = _nssplit(qualifiedName)
                    attr = self.getAttributeNodeNS(namespaceURI, localname)
                    if attr is None:
                        # for performance
            Severity: Minor
            Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xml/dom/minidom.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 getDOMImplementation has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            def getDOMImplementation(features=None):
                if features:
                    if isinstance(features, StringTypes):
                        features = domreg._parse_feature_string(features)
                    for f, v in features:
            Severity: Minor
            Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xml/dom/minidom.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_wholeText has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def _get_wholeText(self):
                    L = [self.data]
                    n = self.previousSibling
                    while n is not None:
                        if n.nodeType in (Node.TEXT_NODE, Node.CDATA_SECTION_NODE):
            Severity: Minor
            Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xml/dom/minidom.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

            Avoid deeply nested control flow statements.
            Open

                                    if attr.value == id:
                                        result = node
                                    elif not node._magic_id_nodes:
                                        break
                                elif attr._is_id:
            Severity: Major
            Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xml/dom/minidom.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if info.isIdNS(attr.namespaceURI, attr.localName):
                                          self._id_cache[attr.value] = node
                                          if attr.value == id:
                                              result = node
                                          elif not node._magic_id_nodes:
              Severity: Major
              Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xml/dom/minidom.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if attr.value == id:
                                            result = node
                            if result is not None:
                Severity: Major
                Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xml/dom/minidom.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if attr.value == id:
                                              result = node
                                          elif node._magic_id_nodes == 1:
                                              break
                              elif node._magic_id_nodes:
                  Severity: Major
                  Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xml/dom/minidom.py - About 45 mins to fix

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

                        def writexml(self, writer, indent="", addindent="", newl="",
                    Severity: Minor
                    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xml/dom/minidom.py - About 35 mins to fix

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

                          def __setattr__(self, name, value):
                              d = self.__dict__
                              if name in ("value", "nodeValue"):
                                  d["value"] = d["nodeValue"] = value
                                  d2 = self.childNodes[0].__dict__
                      Severity: Minor
                      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xml/dom/minidom.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 _set_prefix has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def _set_prefix(self, prefix):
                              nsuri = self.namespaceURI
                              if prefix == "xmlns":
                                  if nsuri and nsuri != XMLNS_NAMESPACE:
                                      raise xml.dom.NamespaceErr(
                      Severity: Minor
                      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xml/dom/minidom.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

                      Avoid too many return statements within this function.
                      Open

                                  return info.isId(self.nodeName)
                      Severity: Major
                      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xml/dom/minidom.py - About 30 mins to fix

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

                            def appendChild(self, node):
                                if node.nodeType == self.DOCUMENT_FRAGMENT_NODE:
                                    for c in tuple(node.childNodes):
                                        self.appendChild(c)
                                    ### The DOM does not clearly specify what to return in this case
                        Severity: Minor
                        Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xml/dom/minidom.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

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

                            def __setitem__(self, attname, value):
                                if isinstance(value, StringTypes):
                                    try:
                                        node = self._attrs[attname]
                                    except KeyError:
                        Severity: Minor
                        Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xml/dom/minidom.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

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

                            def _get_isId(self):
                                if self._is_id:
                                    return True
                                doc = self.ownerDocument
                                elem = self.ownerElement
                        Severity: Minor
                        Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xml/dom/minidom.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

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

                            def setUserData(self, key, data, handler):
                                old = None
                                try:
                                    d = self._user_data
                                except AttributeError:
                        Severity: Minor
                        Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xml/dom/minidom.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

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

                        def _get_elements_by_tagName_helper(parent, name, rc):
                            for node in parent.childNodes:
                                if node.nodeType == Node.ELEMENT_NODE and \
                                    (name == "*" or node.tagName == name):
                                    rc.append(node)
                        Severity: Minor
                        Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xml/dom/minidom.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

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

                            def splitText(self, offset):
                                if offset < 0 or offset > len(self.data):
                                    raise xml.dom.IndexSizeErr("illegal offset value")
                                newText = self.__class__()
                                newText.data = self.data[offset:]
                        Severity: Minor
                        Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xml/dom/minidom.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

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

                            def setAttributeNode(self, attr):
                                if attr.ownerElement not in (None, self):
                                    raise xml.dom.InuseAttributeErr("attribute node already owned")
                                old1 = self._attrs.get(attr.name, None)
                                if old1 is not None:
                        Severity: Minor
                        Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xml/dom/minidom.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

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

                            def _call_user_data_handler(self, operation, src, dst):
                                if hasattr(self, "_user_data"):
                                    for key, (data, handler) in self._user_data.items():
                                        if handler is not None:
                                            handler.handle(operation, key, data, src, dst)
                        Severity: Minor
                        Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xml/dom/minidom.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

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                        vector-uefi/fd/efi/StdLib/lib/python.27/xml/dom/minidom.py on lines 0..1937

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 12524.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        There are no issues that match your filters.

                        Category
                        Status