hackedteam/vector-exploit

View on GitHub
ht-2013-003-Powerpoint/pylzma.egg/py7zlib.py

Summary

Maintainability
F
4 days
Test Coverage

File py7zlib.py has 591 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/python -u
#
# Python Bindings for LZMA
#
# Copyright (c) 2004-2010 by Joachim Bauch, mail@joachim-bauch.de
Severity: Major
Found in ht-2013-003-Powerpoint/pylzma.egg/py7zlib.py - About 1 day to fix

    Function __init__ has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
    Open

        def __init__(self, file):
            self.numfiles = self._read64Bit(file)
            self.files = [{'emptystream': False} for x in xrange(self.numfiles)]
            numemptystreams = 0
            while True:
    Severity: Minor
    Found in ht-2013-003-Powerpoint/pylzma.egg/py7zlib.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

    Function __init__ has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

        def __init__(self, file, password=None):
            self._file = file
            self.password = password
            self.header = file.read(len(MAGIC_7Z))
            if self.header != MAGIC_7Z:
    Severity: Minor
    Found in ht-2013-003-Powerpoint/pylzma.egg/py7zlib.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 __init__ has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

        def __init__(self, file, numfolders, folders):
            self.digests = []
            self.digestsdefined = []
            id = file.read(1)
            if id == PROPERTY_NUM_UNPACK_STREAM:
    Severity: Minor
    Found in ht-2013-003-Powerpoint/pylzma.egg/py7zlib.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

    Function __init__ has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        def __init__(self, file):
            numcoders = self._read64Bit(file)
            self.coders = []
            self.digestdefined = False
            totalin = 0
    Severity: Minor
    Found in ht-2013-003-Powerpoint/pylzma.egg/py7zlib.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 _read_from_decompressor has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def _read_from_decompressor(self, coder, decompressor, input, checkremaining=False):
            data = ''
            idx = 0
            cnt = 0
            self._file.seek(self._src_start)
    Severity: Minor
    Found in ht-2013-003-Powerpoint/pylzma.egg/py7zlib.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 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def __init__(self, file, password=None):
            self._file = file
            self.password = password
            self.header = file.read(len(MAGIC_7Z))
            if self.header != MAGIC_7Z:
    Severity: Minor
    Found in ht-2013-003-Powerpoint/pylzma.egg/py7zlib.py - About 1 hr to fix

      Function __init__ has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def __init__(self, file):
              id = file.read(1)
              if id != PROPERTY_FOLDER:
                  raise FormatError, 'folder id expected but %s found' % repr(id)
              self.numfolders = self._read64Bit(file)
      Severity: Minor
      Found in ht-2013-003-Powerpoint/pylzma.egg/py7zlib.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 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(self, info, start, src_start, size, folder, archive, maxsize=None):
      Severity: Major
      Found in ht-2013-003-Powerpoint/pylzma.egg/py7zlib.py - About 50 mins to fix

        Function _read_7z_aes256_sha256 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def _read_7z_aes256_sha256(self, coder, input):
                if not self._archive.password:
                    raise NoPasswordGivenError()
                
                # TODO: this needs some sanity checks
        Severity: Minor
        Found in ht-2013-003-Powerpoint/pylzma.egg/py7zlib.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 ch == '\0\0':
                                    f['filename'] = unicode(name, 'utf-16')
                                    break
                                name += ch
        Severity: Major
        Found in ht-2013-003-Powerpoint/pylzma.egg/py7zlib.py - About 45 mins to fix

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

              def read(self):
                  if not self._folder.coders:
                      raise TypeError("file has no coder informations")
                  
                  data = None
          Severity: Minor
          Found in ht-2013-003-Powerpoint/pylzma.egg/py7zlib.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 list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def list(self, verbose=True):
                  print 'total %d files in %sarchive' % (self.numfiles, (self.solid and 'solid ') or '')
                  if not verbose:
                      print '\n'.join(self.filenames)
                      return
          Severity: Minor
          Found in ht-2013-003-Powerpoint/pylzma.egg/py7zlib.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 _readBoolean has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def _readBoolean(self, file, count, checkall=0):
                  if checkall:
                      alldefined = file.read(1)
                      if alldefined != '\x00':
                          return [True] * count
          Severity: Minor
          Found in ht-2013-003-Powerpoint/pylzma.egg/py7zlib.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

          There are no issues that match your filters.

          Category
          Status