hackedteam/vector-edk

View on GitHub

Showing 9,525 of 13,510 total issues

Avoid deeply nested control flow statements.
Open

               if (ui_string[-4:] != '.efi'): ui_string = "%s.efi" % ui_string
               #print ui_string
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 nk is not None:
                                #self.add(cur, (nk, i))
                                #INLINED --v
                                new = (nk, i)
                                if new not in cur:
    Severity: Major
    Found in AppPkg/Applications/Python/Python-2.7.2/Parser/spark.py - About 45 mins to fix

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

          def run(self, module_argv ):
              wp = self.check_BIOS_write_protection()    
              spr = self.check_SPI_protected_ranges()
              #spi.display_SPI_Ranges_Access_Permissions()
              #check_SMI_locks()
      Severity: Minor
      Found in vector-uefi/fd/tool/chipsec/modules/common/bios_wp.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 _dump has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def _dump(tokens, sets, states):
          for i in range(len(sets)):
              print 'set', i
              for item in sets[i]:
                  print '\t', item
      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 limit > end:
                                  areas_to_protect.remove(area)
                              else:
                                  areas_to_protect.remove(area)
                                  area = (limit+1,end)
      Severity: Major
      Found in vector-uefi/fd/tool/chipsec/modules/common/bios_wp.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                       if efi_file != None:
                          os.rename(os.path.join(parent_path, efi_file), os.path.join(parent_path, ui_string))
                          efi_file = None
                 if (SecType in (EFI_SECTION_COMPRESSION, EFI_SECTION_GUID_DEFINED, EFI_SECTION_FIRMWARE_VOLUME_IMAGE)):
        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 new not in cur:
                                      self.links[key] = []
                                      cur.append(new)
                                  self.links[key].append((pptr, why))
          Severity: Major
          Found in AppPkg/Applications/Python/Python-2.7.2/Parser/spark.py - About 45 mins to fix

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

                def tokenize(self, s):
                    pos = 0
                    n = len(s)
                    while pos < n:
                        m = self.re.match(s, pos)
            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 new not in next:
                                        next.append(new)
                                    #INLINED --^
                        else:
            Severity: Major
            Found in AppPkg/Applications/Python/Python-2.7.2/Parser/spark.py - About 45 mins to fix

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

              def mem(argv):
                  phys_address_hi = 0
                  phys_address_lo = 0
                  phys_address    = 0
                  size = 0x100
              Severity: Minor
              Found in vector-uefi/fd/tool/chipsec/utilcmd/mem_cmd.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 print_buffer has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              def print_buffer( arr, length = 16 ):
                  """Prints the buffer."""
                  tmp=[]
                  tmp_str=[]
                  i=1
              Severity: Minor
              Found in vector-uefi/fd/tool/chipsec/logger.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 (Type not in (EFI_FV_FILETYPE_ALL, EFI_FV_FILETYPE_RAW, EFI_FV_FILETYPE_FFS_PAD)):
                                  os.makedirs( file_dir_path )
                                  parse_uefi_section(_uefi, FileImage, Size, HeaderSize, polarity, FvOffset + cur_offset, file_dir_path, decode_log_path)
                               elif (Type == EFI_FV_FILETYPE_RAW):
                                  if ((Name == NVAR_NVRAM_FS_FILE) and UD):
              Severity: Major
              Found in vector-uefi/fd/tool/chipsec/hal/spi_uefi.py - About 45 mins to fix

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

                def getEFIvariables_NVAR_simple( nvram_buf ):
                    nvsize = len(nvram_buf)
                    hdr_fmt = NVAR_HDR_FMT
                    hdr_size = struct.calcsize( hdr_fmt )
                    variables = dict()
                Severity: Minor
                Found in vector-uefi/fd/tool/chipsec/hal/uefi_platform.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 read_mmcfg_reg has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def read_mmcfg_reg( cs, bus, dev, fun, off, size ):
                Severity: Minor
                Found in vector-uefi/fd/tool/chipsec/hal/mmio.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

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

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

                        def disable_BIOS_write_protection( self ):
                            (BcRegister, reg_value) = self.get_BIOS_Control()
                            if logger().VERBOSE:
                               logger().log( BcRegister )
                    
                    Severity: Minor
                    Found in vector-uefi/fd/tool/chipsec/hal/spi.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 cmos has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def cmos(argv):
                        if 3 > len(argv):
                          print usage
                          return
                    
                    Severity: Minor
                    Found in vector-uefi/fd/tool/chipsec/utilcmd/cmos_cmd.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 compile_file(arg, ddir, force, rx, quiet):
                                                success = 0
                            else:
                    Severity: Major
                    Found in vector-uefi/fd/efi/StdLib/lib/python.27/compileall.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 vector-uefi/fd/efi/StdLib/lib/python.27/xmllib.py - About 45 mins to fix

                        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 vector-uefi/fd/efi/StdLib/lib/python.27/xmllib.py - About 45 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language