hackedteam/vector-edk

View on GitHub
vector-uefi/fd/efi/StdLib/lib/python.27/gzip.py

Summary

Maintainability
D
2 days
Test Coverage

File gzip.py has 380 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Functions that read and write gzipped files.

The user of the file doesn't have to worry about the compression,
but random access is not allowed."""
Severity: Minor
Found in vector-uefi/fd/efi/StdLib/lib/python.27/gzip.py - About 5 hrs to fix

    Function _test has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

    def _test():
        # Act like gzip; with -d, act like gunzip.
        # The input file is not deleted, however, nor are any other gzip
        # options or features supported.
        args = sys.argv[1:]
    Severity: Minor
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/gzip.py - About 4 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

    GzipFile has 24 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class GzipFile(io.BufferedIOBase):
        """The GzipFile class simulates most of the methods of a file object with
        the exception of the readinto() and truncate() methods.
    
        """
    Severity: Minor
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/gzip.py - About 2 hrs to fix

      Function _read_gzip_header has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def _read_gzip_header(self):
              magic = self.fileobj.read(2)
              if magic != '\037\213':
                  raise IOError, 'Not a gzipped file'
              method = ord( self.fileobj.read(1) )
      Severity: Minor
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/gzip.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 read has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          def read(self, size=-1):
              self._check_closed()
              if self.mode != READ:
                  import errno
                  raise IOError(errno.EBADF, "read() on write-only GzipFile object")
      Severity: Minor
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/gzip.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 __init__ has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          def __init__(self, filename=None, mode=None,
                       compresslevel=9, fileobj=None, mtime=None):
              """Constructor for the GzipFile class.
      
              At least one of fileobj and filename must be given a
      Severity: Minor
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/gzip.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 seek has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def seek(self, offset, whence=0):
              if whence:
                  if whence == 1:
                      offset = self.offset + offset
                  else:
      Severity: Minor
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/gzip.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 readline has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def readline(self, size=-1):
              if size < 0:
                  # Shortcut common case - newline found in buffer.
                  offset = self.offset - self.extrastart
                  i = self.extrabuf.find('\n', offset) + 1
      Severity: Minor
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/gzip.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 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(self, filename=None, mode=None,
      Severity: Minor
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/gzip.py - About 35 mins to fix

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

            def _read(self, size=1024):
                if self.fileobj is None:
                    raise EOFError, "Reached EOF"
        
                if self._new_member:
        Severity: Minor
        Found in vector-uefi/fd/efi/StdLib/lib/python.27/gzip.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

        There are no issues that match your filters.

        Category
        Status