hackedteam/vector-edk

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

Summary

Maintainability
F
2 mos
Test Coverage

File cgi.py has 840 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#! /usr/local/bin/python

# NOTE: the above "/usr/local/bin/python" is NOT a mistake.  It is
# intentionally NOT "/usr/bin/env python".  On many systems
# (e.g. Solaris), /usr/local/bin is not in $PATH as passed to CGI
Severity: Major
Found in AppPkg/Applications/Python/Python-2.7.2/Lib/cgi.py - About 2 days to fix

    Function parse_multipart has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
    Open

    def parse_multipart(fp, pdict):
        """Parse multipart input.
    
        Arguments:
        fp   : input file
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/cgi.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 __init__ has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
    Open

        def __init__(self, fp=None, headers=None, outerboundary="",
                     environ=os.environ, keep_blank_values=0, strict_parsing=0):
            """Constructor.  Read multipart/* until last part.
    
            Arguments, all optional:
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/cgi.py - About 5 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 has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

    def parse(fp=None, environ=os.environ, keep_blank_values=0, strict_parsing=0):
        """Parse a query in the environment or from a file (default stdin)
    
            Arguments, all optional:
    
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/cgi.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

    FieldStorage has 23 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class FieldStorage:
    
        """Store a sequence of fields, reading multipart/form-data.
    
        This class provides naming, typing, files stored on disk, and
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/cgi.py - About 2 hrs to fix

      Function read_lines_to_outerboundary has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          def read_lines_to_outerboundary(self):
              """Internal: read lines until outerboundary."""
              next = "--" + self.outerboundary
              last = next + "--"
              delim = ""
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/cgi.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 skip_lines has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def skip_lines(self):
              """Internal: skip lines until outer boundary if defined."""
              if not self.outerboundary or self.done:
                  return
              next = "--" + self.outerboundary
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/cgi.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 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def __init__(self, fp=None, headers=None, outerboundary="",
                       environ=os.environ, keep_blank_values=0, strict_parsing=0):
              """Constructor.  Read multipart/* until last part.
      
              Arguments, all optional:
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/cgi.py - About 1 hr to fix

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

            def __init__(self, fp=None, headers=None, outerboundary="",
        Severity: Minor
        Found in AppPkg/Applications/Python/Python-2.7.2/Lib/cgi.py - About 45 mins to fix

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

              def __getitem__(self, key):
                  """Dictionary style indexing."""
                  if self.list is None:
                      raise TypeError, "not indexable"
                  found = []
          Severity: Minor
          Found in AppPkg/Applications/Python/Python-2.7.2/Lib/cgi.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 initlog has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def initlog(*allargs):
              """Write a log message, if there is a log file.
          
              Even though this function is called initlog(), you should always
              use log(); log is a variable that is set either to initlog
          Severity: Minor
          Found in AppPkg/Applications/Python/Python-2.7.2/Lib/cgi.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 parse_header has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def parse_header(line):
              """Parse a Content-type like header.
          
              Return the main content-type and a dictionary of options.
          
          Severity: Minor
          Found in AppPkg/Applications/Python/Python-2.7.2/Lib/cgi.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 read_multi has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def read_multi(self, environ, keep_blank_values, strict_parsing):
                  """Internal: read a part that is itself multipart."""
                  ib = self.innerboundary
                  if not valid_boundary(ib):
                      raise ValueError, 'Invalid boundary in multipart form: %r' % (ib,)
          Severity: Minor
          Found in AppPkg/Applications/Python/Python-2.7.2/Lib/cgi.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 read_binary has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def read_binary(self):
                  """Internal: read binary data."""
                  self.file = self.make_file('b')
                  todo = self.length
                  if todo >= 0:
          Severity: Minor
          Found in AppPkg/Applications/Python/Python-2.7.2/Lib/cgi.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 __getitem__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def __getitem__(self, key):
                  v = SvFormContentDict.__getitem__(self, key)
                  if v[0] in '0123456789+-.':
                      try: return int(v)
                      except ValueError:
          Severity: Minor
          Found in AppPkg/Applications/Python/Python-2.7.2/Lib/cgi.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

          Severity: Major
          Found in AppPkg/Applications/Python/Python-2.7.2/Lib/cgi.py and 1 other location - About 1 mo to fix
          vector-uefi/fd/efi/StdLib/lib/python.27/cgi.py on lines 0..1051

          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 5368.

          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