hackedteam/vector-edk

View on GitHub

Showing 9,525 of 13,510 total issues

Avoid deeply nested control flow statements.
Open

                    if StringTableIndex == 0:
                        Dict['STRING_TABLE_INDEX'].append('')
                    else:
                        Dict['STRING_TABLE_INDEX'].append('_%d' % StringTableIndex)
                    if Sku.DefaultValue[0] == 'L':
Severity: Major
Found in BaseTools/Source/Python/AutoGen/GenPcdDb.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if ConsumedByList[Item] == []:
                                # insert Item into Q
                                Q.insert(0, Item)
                                break
                        if Q != []:
    Severity: Major
    Found in BaseTools/Source/Python/AutoGen/AutoGen.py - About 45 mins to fix

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

      def GetIntegerValue(Input):
          if type(Input) in (int, long):
              return Input
          String = Input
          if String.endswith("U"):
      Severity: Minor
      Found in BaseTools/Source/Python/AutoGen/GenPcdDb.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 Sku.DefaultValue[0] == 'L':
                              DefaultValueBinStructure = StringToArray(Sku.DefaultValue)
                              Size = len(DefaultValueBinStructure.replace(',',' ').split())
                              Dict['STRING_TABLE_VALUE'].append(DefaultValueBinStructure)
                          elif Sku.DefaultValue[0] == '"':
      Severity: Major
      Found in BaseTools/Source/Python/AutoGen/GenPcdDb.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if Dict['TOKEN_CNAME'][Count] == Dict['SIZE_TABLE_CNAME'][Count1] and \
                                Dict['TOKEN_GUID'][Count] == Dict['SIZE_TABLE_GUID'][Count1]:
                                SizeCNameTempList.append(Dict['SIZE_TABLE_CNAME'][Count1])
                                SizeGuidTempList.append(Dict['SIZE_TABLE_GUID'][Count1])
                                SizeCurLenTempList.append(Dict['SIZE_TABLE_CURRENT_LENGTH'][Count1])
        Severity: Major
        Found in BaseTools/Source/Python/AutoGen/GenPcdDb.py - About 45 mins to fix

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

              def Insert(self, Name, ExtName, Path, FullPath, Model, TimeStamp):
          Severity: Minor
          Found in BaseTools/Source/Python/Table/TableFile.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if Arch == self.Arch or Arch == "*":
                                        if Options[Key].startswith("="):
                                            if OverrideList.get(Key[1]) != None:                                                
                                                OverrideList.pop(Key[1])
                                            OverrideList[Key[1]] = Options[Key]
            Severity: Major
            Found in BaseTools/Source/Python/AutoGen/AutoGen.py - About 45 mins to fix

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

                  def __init__(self, ItemSize, DataList=None, RawDataList=None, LenList=None):
                      if DataList is None:
                          DataList = []
                      if RawDataList is None:
                          RawDataList = []
              Severity: Minor
              Found in BaseTools/Source/Python/AutoGen/GenPcdDb.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 UniLanguage in UniLanguageList:
                                      if UniLanguage.startswith('en-') or UniLanguage.startswith('eng-'):
                                          if UniLanguage not in UniLanguageListFiltered:
                                              UniLanguageListFiltered += [UniLanguage]
                                          break
              Severity: Major
              Found in BaseTools/Source/Python/AutoGen/StrGather.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    if DeclSplitList[0][Index:].startswith('EFIAPI'):
                                        Index += 6
                                        FuncNameStartColumn += 6
                                        PreChar = ''
                                        continue
                Severity: Major
                Found in BaseTools/Source/Python/Ecc/c.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if Tool == "MAKE":
                                              MakePath = Value
                                          else:
                                              ToolsDef += "%s = %s\n" % (Tool, Value)
                                      elif Attr != "DLL":
                  Severity: Major
                  Found in BaseTools/Source/Python/AutoGen/AutoGen.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if ToolChain1 == ToolChain2 or ToolChain1 == "*" or ToolChain2 == "*":
                                                if Arch1 == Arch2 or Arch1 == "*" or Arch2 == "*":
                                                    if CommandType1 == CommandType2 or CommandType1 == "*" or CommandType2 == "*":
                                                        if Attr1 == Attr2 or Attr1 == "*" or Attr2 == "*":
                                                            if self.CalculatePriorityValue(NowKey) > self.CalculatePriorityValue(NextKey):
                    Severity: Major
                    Found in BaseTools/Source/Python/AutoGen/AutoGen.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if DepexList[-1] == 'END':  # no need of a END at this time
                                                  DepexList.pop()
                                              DepexList.append(')')
                      Severity: Major
                      Found in BaseTools/Source/Python/AutoGen/AutoGen.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                if FixedAtBuildPcds[key] != Pcd.DefaultValue:
                                                    ShareFixedAtBuildPcdsSameValue[key] = False      
                                    for Pcd in LibAuto.FixedAtBuildPcds:
                        Severity: Major
                        Found in BaseTools/Source/Python/AutoGen/AutoGen.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                  if ToolDef.has_key("GUID") and ToolDef["GUID"] == self.Platform.VpdToolGuid:
                                                      if not ToolDef.has_key("PATH"):
                                                          EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE, "PATH attribute was not provided for BPDG guid tool %s in tools_def.txt" % self.Platform.VpdToolGuid)
                                                      BPDGToolName = ToolDef["PATH"]
                                                      break
                          Severity: Major
                          Found in BaseTools/Source/Python/AutoGen/AutoGen.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                    if Unicode:
                                                        Padding = Padding * 2
                                                        ArraySize = ArraySize / 2
                                                    if ArraySize < (len(PcdValue) + 1):
                            Severity: Major
                            Found in BaseTools/Source/Python/AutoGen/AutoGen.py - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                  if Type != None:
                                                      if Type.find('BOOLEAN') == -1:
                                                          PrintErrorMsg(ERROR_PREDICATE_EXPRESSION_CHECK_NO_BOOLEAN_OPERATOR, 'Predicate Expression: %s' % Exp, FileTable, Str[2])
                                                      continue
                              
                              Severity: Major
                              Found in BaseTools/Source/Python/Ecc/c.py - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                    if Type != None:
                                                        if Type.find('BOOLEAN') != -1:
                                                            PrintErrorMsg(ERROR_PREDICATE_EXPRESSION_CHECK_BOOLEAN_VALUE, 'Predicate Expression: %s' % Exp, FileTable, Str[2])
                                                        continue
                                
                                Severity: Major
                                Found in BaseTools/Source/Python/Ecc/c.py - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                          if Item not in LibraryClasses[List[0]]:
                                                              LibraryClasses[List[0]].append(Item)
                                  
                                  Severity: Major
                                  Found in BaseTools/Source/Python/Ecc/Check.py - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                            if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_DEPENDENT, LibraryClass[1]):
                                                                EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_DEPENDENT, OtherMsg="The Library Class [%s] is not specified in '%s'" % (LibraryClass[1], LibraryClass[2]), BelongsToTable='Dsc', BelongsToItem=LibraryClass[0])
                                    
                                        # Check whether the Library Instances specified by the LibraryClasses sections are listed in order of dependencies
                                        def MetaDataFileCheckLibraryInstanceOrder(self):
                                    Severity: Major
                                    Found in BaseTools/Source/Python/Ecc/Check.py - About 45 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language