hackedteam/vector-edk

View on GitHub

Showing 9,525 of 13,510 total issues

Avoid deeply nested control flow statements.
Open

                        if self.BuildOption[Tool][Attr].startswith('='):
                            Value = self.BuildOption[Tool][Attr][1:]
                        else:
                            Value += " " + self.BuildOption[Tool][Attr]
Severity: Major
Found in BaseTools/Source/Python/AutoGen/AutoGen.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if Comment.find(Usage) != -1:
                                UsageIndex = Index
                                break
                    if UsageIndex != -1:
    Severity: Major
    Found in BaseTools/Source/Python/AutoGen/AutoGen.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if Pcd.MaxDatumSize != '':
                              MaxDatumSize = int(Pcd.MaxDatumSize, 0)
                              if MaxDatumSize < Size:
                                  EdkLogger.error("build", AUTOGEN_ERROR,
                                                  "The maximum size of VOID* type PCD '%s.%s' is less than its actual size occupied." % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName),
      Severity: Major
      Found in BaseTools/Source/Python/AutoGen/GenPcdDb.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if Sku.DefaultValue in ["1", "0"]:
                                ValueList.append(Sku.DefaultValue + "U")              
                        else:
        Severity: Major
        Found in BaseTools/Source/Python/AutoGen/GenPcdDb.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

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

            Avoid deeply nested control flow statements.
            Open

                                    for Module in Pa.ModuleAutoGenList:
                                        if path.normpath(Module.MetaFile.File) == path.normpath(FfsFile.InfFileName):
                                            InfFoundFlag = True
                                            if not Module.Guid.upper() in _GuidDict.keys():
                                                _GuidDict[Module.Guid.upper()] = FfsFile
            Severity: Major
            Found in BaseTools/Source/Python/AutoGen/AutoGen.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if Tool not in BuildOptions:
                                          BuildOptions[Tool] = {}
                                      if Attr != "FLAGS" or Attr not in BuildOptions[Tool]:
              Severity: Major
              Found in BaseTools/Source/Python/AutoGen/AutoGen.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    if len(Type.strip()) == 0:
                                        Type = TypeList[-2]
                                TypedefDict = GetTypedefDict(FullFileName)
                Severity: Major
                Found in BaseTools/Source/Python/Ecc/c.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if self.ModuleType != self.BuildType:
                                              RuleObject = BuildRuleDatabase[Type, self.ModuleType, self.Arch, self.ToolChainFamily]
                                  if not RuleObject:
                  Severity: Major
                  Found in BaseTools/Source/Python/AutoGen/AutoGen.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            for Index in range(0, len(PcdValue)):
                                                if Unicode:
                                                    CharVal = ord(PcdValue[Index])
                                                    NewValue = NewValue + '0x%02x' % (CharVal & 0x00FF) + ', ' \
                                                            + '0x%02x' % (CharVal >> 8) + ', '
                    Severity: Major
                    Found in BaseTools/Source/Python/AutoGen/AutoGen.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          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 Sku.VpdOffset == '':
                                                VoidStarTypeCurrSize.append(str(Size) + 'U')
                                            Dict['STRING_TABLE_LENGTH'].append(StringTabLen)
                        Severity: Major
                        Found in BaseTools/Source/Python/AutoGen/GenPcdDb.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                  if FfsFile.InfFileName.find('$') == -1:
                                                      InfPath = NormPath(FfsFile.InfFileName)
                                                      if not os.path.exists(InfPath):
                                                          EdkLogger.error('build', GENFDS_ERROR, "Non-existant Module %s !" % (FfsFile.InfFileName))
                                                          
                          Severity: Major
                          Found in BaseTools/Source/Python/AutoGen/AutoGen.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                    if Attr != "FLAGS" or Attr not in BuildOptions[Tool]:
                                                        BuildOptions[Tool][Attr] = Options[Key]
                                                    else:
                                                        # append options for the same tool
                                                        BuildOptions[Tool][Attr] += " " + Options[Key]
                            Severity: Major
                            Found in BaseTools/Source/Python/AutoGen/AutoGen.py - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                      if ArraySize > len(PcdValue) + 1:
                                                          NewValue = NewValue + Padding * (ArraySize - len(PcdValue) - 1)
                                                      PcdValue = NewValue + Padding.strip().rstrip(',') + '}'
                              Severity: Major
                              Found in BaseTools/Source/Python/AutoGen/AutoGen.py - About 45 mins to fix

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

                                def GetStringFiles(UniFilList, SourceFileList, IncludeList, IncludePathList, SkipList, BaseName, IsCompatibleMode = False, ShellMode = False, UniGenCFlag = True, UniGenBinBuffer = None, FilterInfo = [True, []]):  
                                    if len(UniFilList) > 0:
                                        if ShellMode:
                                            #
                                            # support ISO 639-2 codes in .UNI files of EDK Shell
                                Severity: Minor
                                Found in BaseTools/Source/Python/AutoGen/StrGather.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 (Pcd[0], Pcd[1], Type) in Package.Pcds:
                                                            EdkLogger.error(
                                                                'build',
                                                                FORMAT_INVALID,
                                                                "Type [%s] of PCD [%s.%s] in DSC file doesn't match the type [%s] defined in DEC file." \
                                Severity: Major
                                Found in BaseTools/Source/Python/AutoGen/AutoGen.py - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                          if LibraryPath == None or LibraryPath == "":
                                                              EdkLogger.error("build", RESOURCE_NOT_AVAILABLE,
                                                                              "Instance of library class [%s] is not found" % LibraryClassName,
                                                                              File=self.MetaFile,
                                                                              ExtraData="in [%s] [%s]\n\tconsumed by module [%s]" % (str(M), self.Arch, str(Module)))
                                  Severity: Major
                                  Found in BaseTools/Source/Python/AutoGen/AutoGen.py - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                            if LibraryName.upper() == Key.upper():
                                                                Library = self.Platform.LibraryClasses[Key, ':dummy:']
                                                                break
                                                        if Library == None:
                                    Severity: Major
                                    Found in BaseTools/Source/Python/AutoGen/AutoGen.py - About 45 mins to fix

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

                                      def CreateCode(Info, AutoGenC, AutoGenH, StringH, UniGenCFlag, UniGenBinBuffer):
                                      Severity: Minor
                                      Found in BaseTools/Source/Python/AutoGen/GenC.py - About 45 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language