hackedteam/vector-edk

View on GitHub

Showing 9,525 of 13,510 total issues

Avoid deeply nested control flow statements.
Open

                        if index != lb:
                            # we found a prefix, collect up to the prefix
                            self.collect_incoming_data (self.ac_in_buffer[:-index])
                            self.ac_in_buffer = self.ac_in_buffer[-index:]
                        break
Severity: Major
Found in AppPkg/Applications/Python/Python-2.7.2/Lib/asynchat.py - About 45 mins to fix

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

        def to_integral_exact(self, rounding=None, context=None):
            """Rounds to a nearby integer.
    
            If no rounding mode is specified, take the rounding mode from
            the context.  This method raises the Rounded and Inexact flags
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/decimal.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 not os.path.exists(sdk):
                            for key in ('LDFLAGS', 'BASECFLAGS',
                                 # a number of derived variables. These need to be
                                 # patched up as well.
                                'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
    Severity: Major
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/sysconfig.py - About 45 mins to fix

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

          def __init__(self, max_size=0, mode='w+b', bufsize=-1,
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/tempfile.py - About 45 mins to fix

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

            def rotate(self, other, context=None):
                """Returns a rotated copy of self, value-of-other times."""
                if context is None:
                    context = getcontext()
        
        Severity: Minor
        Found in AppPkg/Applications/Python/Python-2.7.2/Lib/decimal.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 __mod__ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def __mod__(self, other, context=None):
                """
                self % other
                """
                other = _convert_other(other)
        Severity: Minor
        Found in AppPkg/Applications/Python/Python-2.7.2/Lib/decimal.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 iter_modules has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        def iter_modules(path=None, prefix=''):
            """Yields (module_loader, name, ispkg) for all submodules on path,
            or, if path is None, all top-level modules on sys.path.
        
            'path' should be either None or a list of paths to look for
        Severity: Minor
        Found in AppPkg/Applications/Python/Python-2.7.2/Lib/pkgutil.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_source has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_source(self, fullname=None):
                fullname = self._fix_name(fullname)
                if self.source is None:
                    mod_type = self.etc[2]
                    if mod_type==imp.PY_SOURCE:
        Severity: Minor
        Found in AppPkg/Applications/Python/Python-2.7.2/Lib/pkgutil.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 _namelist has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        def _namelist(instance):
            namelist, namedict, classlist = [], {}, [instance.__class__]
            for c in classlist:
                for b in c.__bases__:
                    classlist.append(b)
        Severity: Minor
        Found in AppPkg/Applications/Python/Python-2.7.2/Parser/spark.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 (sguid == EFI_CRC32_GUIDED_SECTION_EXTRACTION_PROTOCOL_GUID):
                          parse_uefi_section(_uefi, SecBody[DataOffset:], Size - DataOffset, 0, polarity, 0, section_dir_path, decode_log_path)
                       #else:
                       #   write_file( os.path.join(section_dir_path, "%s-%04X" % (sguid, Attributes)), SecBody[DataOffset:] )
                       pass
        Severity: Major
        Found in vector-uefi/fd/tool/chipsec/hal/spi_uefi.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                         if decompressed:
                            parse_uefi_section(_uefi, decompressed, len(decompressed), 0, polarity, 0, section_dir_path, decode_log_path)
                            pass
                      elif (SecType == EFI_SECTION_GUID_DEFINED):
          Severity: Major
          Found in vector-uefi/fd/tool/chipsec/hal/spi_uefi.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                if op is LITERAL:
                                    cappend((op, av))
                                else:
                                    break
                            else:
            Severity: Major
            Found in AppPkg/Applications/Python/Python-2.7.2/Lib/sre_compile.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                               if os.path.exists( file_path ):
                                  file_path = file_path + ("_%08X" % cur_offset)
                               write_file( file_path, FileImage )
              Severity: Major
              Found in vector-uefi/fd/tool/chipsec/hal/spi_uefi.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        for prule in rules[nextSym]:
                                            ppos = self.skip(prule)
                                            new = (prule, ppos)
                                            NK.items.append(new)
                            #
                Severity: Major
                Found in AppPkg/Applications/Python/Python-2.7.2/Parser/spark.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if nk is not None:
                                              self.add(cur, (nk, i))
                  
                  Severity: Major
                  Found in AppPkg/Applications/Python/Python-2.7.2/Parser/spark.py - About 45 mins to fix

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

                        def _wait_for_cycle( self, smbus_io_base ):
                            # wait for cycle to complete
                            #while True:
                            for i in range(10):
                                sts = self.cs.io.read_port_byte( smbus_io_base )
                    Severity: Minor
                    Found in vector-uefi/fd/tool/chipsec/hal/smbus.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

                                        for p in av[1]:
                                            if not p:
                                                break
                                            op, av = p[0]
                                            if op is LITERAL:
                    Severity: Major
                    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/sre_compile.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if nk is not None:
                                                  self.add(next, (nk, i+1))
                      
                      Severity: Major
                      Found in AppPkg/Applications/Python/Python-2.7.2/Parser/spark.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                         if Type in FILE_TYPE_NAMES.keys():
                                            file_type_str = FILE_TYPE_NAMES[Type]
                                         file_path = os.path.join( volume_path, "%s.%s-%02X" % (Name, file_type_str, Type))
                        Severity: Major
                        Found in vector-uefi/fd/tool/chipsec/hal/spi_uefi.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                  if base < start:
                                                      areas_to_protect.remove(area)
                                                  else:
                                                      areas_to_protect.remove(area)
                                                      area = (start,base-1)
                          Severity: Major
                          Found in vector-uefi/fd/tool/chipsec/modules/common/bios_wp.py - About 45 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language