hackedteam/vector-edk

View on GitHub

Showing 9,525 of 13,510 total issues

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

def _getuserbase():
    env_base = os.environ.get("PYTHONUSERBASE", None)
    def joinuser(*args):
        return os.path.expanduser(os.path.join(*args))
Severity: Minor
Found in vector-uefi/fd/efi/StdLib/lib/python.27/sysconfig.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 vector-uefi/fd/efi/StdLib/lib/python.27/sysconfig.py - About 45 mins to fix

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

            def print_log(self):
                self._mesg('last %d IMAP4 interactions:' % len(self._cmd_log))
                i, n = self._cmd_log_idx, self._cmd_log_len
                while n:
                    try:
    Severity: Minor
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/imaplib.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 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 vector-uefi/fd/efi/StdLib/lib/python.27/asynchat.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 vector-uefi/fd/efi/StdLib/lib/python.27/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 __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 vector-uefi/fd/efi/StdLib/lib/python.27/tempfile.py - About 45 mins to fix

        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 vector-uefi/fd/efi/StdLib/lib/python.27/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 vector-uefi/fd/efi/StdLib/lib/python.27/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

        Method GetTotalRating has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                    UInt32 dictionarySize,
                    UInt64 elapsedTimeEn, UInt64 sizeEn,
                    UInt64 elapsedTimeDe,
                    UInt64 inSizeDe, UInt64 outSizeDe)
        Severity: Minor
        Found in vector-uefi/insyde/7zip/CS/7zip/Compress/LzmaAlone/LzmaBench.cs - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                      if (lenTest < numAvailableBytesFull)
                                      {
                                          UInt32 t = Math.Min(numAvailableBytesFull - 1 - lenTest, _numFastBytes);
                                          UInt32 lenTest2 = _matchFinder.GetMatchLen((Int32)lenTest, curBack, t);
                                          if (lenTest2 >= 2)
          Severity: Major
          Found in vector-uefi/insyde/7zip/CS/7zip/Compress/LZMA/LzmaEncoder.cs - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                        if (offs == numDistancePairs)
                                            break;
            Severity: Major
            Found in vector-uefi/insyde/7zip/CS/7zip/Compress/LZMA/LzmaEncoder.cs - About 45 mins to fix

              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 vector-uefi/fd/efi/StdLib/lib/python.27/sre_compile.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 vector-uefi/fd/efi/StdLib/lib/python.27/sre_compile.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                                  while(lenEnd < cur + offset)
                                                      _optimum[++lenEnd].Price = kIfinityPrice;
                  Severity: Major
                  Found in vector-uefi/insyde/7zip/CS/7zip/Compress/LZMA/LzmaEncoder.cs - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                        if not p:
                                            break
                                        op, av = p[0]
                    Severity: Major
                    Found in vector-uefi/fd/efi/StdLib/lib/python.27/sre_compile.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                                      if (curAndLenPrice < optimum.Price) 
                                                      {
                                                          optimum.Price = curAndLenPrice;
                                                          optimum.PosPrev = cur + lenTest + 1;
                                                          optimum.BackPrev = 0;
                      Severity: Major
                      Found in vector-uefi/insyde/7zip/CS/7zip/Compress/LZMA/LzmaEncoder.cs - About 45 mins to fix

                        Consider simplifying this complex logical expression.
                        Open

                                if (
                                        lp < 0 || lp > Base.kNumLitPosStatesBitsEncodingMax ||
                                        lc < 0 || lc > Base.kNumLitContextBitsMax ||
                                        pb < 0 || pb > Base.kNumPosStatesBitsEncodingMax)
                                    return false;
                        Severity: Major
                        Found in vector-uefi/insyde/7zip/Java/SevenZip/Compression/LZMA/Encoder.java - About 40 mins to fix

                          Consider simplifying this complex logical expression.
                          Open

                                  if (TempChar >= 'a' and TempChar <= 'f') or (TempChar >= 'A' and TempChar <= 'F') \
                                          or (TempChar >= '0' and TempChar <= '9'):
                                              return True
                                  else:
                                      return False
                          Severity: Major
                          Found in BaseTools/Source/Python/Common/FdfParserLite.py - About 40 mins to fix

                            Consider simplifying this complex logical expression.
                            Open

                                        if not S.startswith("[FD.") and not S.startswith("[FV.") and not S.startswith("[CAPSULE.") \
                                            and not S.startswith("[VTF.") and not S.startswith("[RULE.") and not S.startswith("[OPTIONROM."):
                                            raise Warning("Unknown section or section appear sequence error (The correct sequence should be [DEFINES], [FD.], [FV.], [Capsule.], [VTF.], [Rule.], [OptionRom.])", self.FileName, self.CurrentLineNumber)
                                        self.__UndoToken()
                            Severity: Major
                            Found in BaseTools/Source/Python/Common/FdfParserLite.py - About 40 mins to fix

                              Consider simplifying this complex logical expression.
                              Open

                                  if (Opt.PackFileToCreate and Opt.PackFileToInstall and Opt.PackFileToRemove):
                                      Logger.Error("UPT", OPTION_CONFLICT, ExtraData=ST.ERR_REQUIRE_I_C_R_OPTION)
                                  elif Opt.PackFileToCreate and Opt.PackFileToInstall:
                                      Logger.Error("UPT", OPTION_CONFLICT, ExtraData=ST.ERR_I_C_EXCLUSIVE)
                                  elif Opt.PackFileToInstall and Opt.PackFileToRemove:
                              Severity: Major
                              Found in BaseTools/Source/Python/UPT/UPT.py - About 40 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language