hackedteam/vector-edk

View on GitHub
AppPkg/Applications/Python/Python-2.7.2/Lib/xmllib.py

Summary

Maintainability
F
1 wk
Test Coverage

Function goahead has a Cognitive Complexity of 163 (exceeds 5 allowed). Consider refactoring.
Open

    def goahead(self, end):
        rawdata = self.rawdata
        i = 0
        n = len(rawdata)
        while i < n:
Severity: Minor
Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xmllib.py - About 3 days 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

File xmllib.py has 794 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""A parser for XML, using the derived class as static DTD."""

# Author: Sjoerd Mullender.

import re
Severity: Major
Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xmllib.py - About 1 day to fix

    Function parse_starttag has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring.
    Open

        def parse_starttag(self, i):
            rawdata = self.rawdata
            # i points to start of tag
            end = endbracketfind.match(rawdata, i+1)
            if end is None:
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xmllib.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

    XMLParser has 35 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class XMLParser:
        attributes = {}                     # default, to be overridden
        elements = {}                       # default, to be overridden
    
        # parsing options, settable using keyword args in __init__
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xmllib.py - About 4 hrs to fix

      Function parse_doctype has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
      Open

          def parse_doctype(self, res):
              rawdata = self.rawdata
              n = len(rawdata)
              name = res.group('name')
              if self.__map_case:
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xmllib.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 translate_references has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

          def translate_references(self, data, all = 1):
              if not self.__translate_attribute_references:
                  return data
              i = 0
              while 1:
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xmllib.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 parse_proc has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

          def parse_proc(self, i):
              rawdata = self.rawdata
              end = procclose.search(rawdata, i)
              if end is None:
                  return -1
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xmllib.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 test has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

      def test(args = None):
          import sys, getopt
          from time import time
      
          if not args:
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xmllib.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 finish_endtag has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          def finish_endtag(self, tag):
              self.literal = 0
              if not tag:
                  self.syntax_error('name-less end tag')
                  found = len(self.stack) - 1
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xmllib.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 parse_attributes has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          def parse_attributes(self, tag, i, j):
              rawdata = self.rawdata
              attrdict = {}
              namespace = {}
              while i < j:
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xmllib.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 parse_endtag has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          def parse_endtag(self, i):
              rawdata = self.rawdata
              end = endbracketfind.match(rawdata, i+1)
              if end is None:
                  return -1
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xmllib.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 __fixdict has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def __fixdict(self, dict):
              for key in dict.keys():
                  if key[:6] == 'start_':
                      tag = key[6:]
                      start, end = self.elements.get(tag, (None, None))
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xmllib.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 ans is not None:
                                  key = ans + ' ' + key
                              else:
                                  key = aprefix + ':' + key
                      nattrdict[key] = val
      Severity: Major
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xmllib.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if ans is None:
                                    ans = self.__namespaces.get(aprefix)
                                if ans is not None:
        Severity: Major
        Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xmllib.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  for t, d, nst in self.stack:
                                      if aprefix in d:
                                          ans = d[aprefix]
                                  if ans is None:
          Severity: Major
          Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xmllib.py - About 45 mins to fix

            Avoid too many return statements within this function.
            Open

                    return res.end(0)
            Severity: Major
            Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xmllib.py - About 30 mins to fix

              There are no issues that match your filters.

              Category
              Status