hackedteam/vector-edk

View on GitHub

Showing 9,525 of 13,510 total issues

Avoid deeply nested control flow statements.
Open

                        for Index in range(1, len(ValueList)):
                            if ValueList[Index][-1] == '=' or ValueList[Index] == '':
                                continue
                            Dummy = Dummy + ' /D ' + ValueList[Index]
                        Value = Dummy.strip()
Severity: Major
Found in BaseTools/Source/Python/Workspace/WorkspaceDatabase.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if '*' in FfsInf.TargetOverrideList or File.Target == '*' or File.Target in FfsInf.TargetOverrideList or FfsInf.TargetOverrideList == []:
                                FileList.append(FfsInf.PatchEfiFile(File.Path))
                            else:
                                GenFdsGlobalVariable.InfLogger ("\nBuild Target \'%s\' of File %s is not in the Scope of %s specified by INF %s in FDF" %(File.Target, File.File, FfsInf.TargetOverrideList, FfsInf.InfFileName))
                        else:
    Severity: Major
    Found in BaseTools/Source/Python/GenFds/Section.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                                  if ElementRegionData != None and ElementRegionData.upper() == FvObj.UiFvName:
                                      if FvObj.BlockSizeList != []:
                                          return FvObj.BlockSizeList[0][0]
                                      else:
                                          return ElementRegion.BlockSizeOfRegion(ElementFd.BlockSizeList)
      Severity: Major
      Found in BaseTools/Source/Python/GenFds/GenFds.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if Value == None:
                                    PackageList = "\n\t".join([str(P) for P in self.Packages])
                                    EdkLogger.error('build', RESOURCE_NOT_AVAILABLE,
                                                    "Value of [%s] is not found in" % Token,
                                                    ExtraData=PackageList, File=self.MetaFile, Line=Record[-1])
        Severity: Major
        Found in BaseTools/Source/Python/Workspace/WorkspaceDatabase.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                      if (TokenValueInt < 0 or TokenValueInt > 4294967295):
                                          EdkLogger.error(
                                                      'build',
                                                      FORMAT_INVALID,
                                                      "The format of TokenValue [%s] of PCD [%s.%s] in [%s] is invalid, as a decimal it should between: 0 - 4294967295!"% (Pcd.TokenValue, TokenSpaceGuid, PcdCName, str(Package)),
          Severity: Major
          Found in BaseTools/Source/Python/Workspace/WorkspaceDatabase.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/GenFds/FfsInfStatement.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if PcdObj.Type != 'FixedAtBuild':
                                          EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not FixedAtBuild type." % PcdPattern)
                                      if PcdObj.DatumType != 'VOID*':
              Severity: Major
              Found in BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py - About 45 mins to fix

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

                    def PreprocessImage(BuildDb, DscFile):
                        PcdDict = BuildDb.BuildObject[DscFile, 'COMMON', GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].Pcds
                        PcdValue = ''
                        for Key in PcdDict:
                            PcdObj = PcdDict[Key]
                Severity: Minor
                Found in BaseTools/Source/Python/GenFds/GenFds.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 __ReplaceFragment has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    def __ReplaceFragment(self, StartPos, EndPos, Value = ' '):
                        if StartPos[0] == EndPos[0]:
                            Offset = StartPos[1]
                            while Offset <= EndPos[1]:
                                self.Profile.FileLinesList[StartPos[0]][Offset] = Value
                Severity: Minor
                Found in BaseTools/Source/Python/GenFds/FdfParser.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 __GetRegionCapType has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    def __GetRegionCapType(self, RegionObj):
                
                        if not self.__IsKeyword("CAPSULE"):
                            raise Warning("expected Keyword 'CAPSULE'", self.FileName, self.CurrentLineNumber)
                
                Severity: Minor
                Found in BaseTools/Source/Python/GenFds/FdfParser.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 __GetNextOp has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    def __GetNextOp(self):
                        # Skip leading spaces, if exist.
                        self.__SkipWhiteSpace()
                        if self.__EndOfFile():
                            return False
                Severity: Minor
                Found in BaseTools/Source/Python/GenFds/FdfParser.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 elementRegionData != None and elementRegionData.upper() not in CapList:
                                            CapList.append(elementRegionData.upper())
                        return CapList
                Severity: Major
                Found in BaseTools/Source/Python/GenFds/FdfParser.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if RefFvName in FvAnalyzedList:
                                              continue
                                          LogStr += "Capsule %s contains FV %s\n" % (CapNameFromStack, RefFvName)
                  Severity: Major
                  Found in BaseTools/Source/Python/GenFds/FdfParser.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if not self.__IsToken( ")"):
                                                raise Warning("expected ')'", self.FileName, self.CurrentLineNumber)
                                            self.__Token = 'PCD('+PcdPair[1]+'.'+PcdPair[0]+')'
                    Severity: Major
                    Found in BaseTools/Source/Python/GenFds/FdfParser.py - About 45 mins to fix

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

                          def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None, Dict = {}) :
                      Severity: Minor
                      Found in BaseTools/Source/Python/GenFds/EfiSection.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                if not self.__IsToken(","):
                                                    break
                        
                        Severity: Major
                        Found in BaseTools/Source/Python/GenFds/FdfParser.py - About 45 mins to fix

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

                              def __GetFvAttributes(self, FvObj):
                                  IsWordToken = False
                                  while self.__GetNextWord():
                                      IsWordToken = True
                                      name = self.__Token
                          Severity: Minor
                          Found in BaseTools/Source/Python/GenFds/FdfParser.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 __GetReferencedFdFvTuple has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def __GetReferencedFdFvTuple(self, FvObj, RefFdList = [], RefFvList = []):
                          
                                  for FfsObj in FvObj.FfsList:
                                      if isinstance(FfsObj, FfsFileStatement.FileStatement):
                                          if FfsObj.FvName != None and FfsObj.FvName.upper() not in RefFvList:
                          Severity: Minor
                          Found in BaseTools/Source/Python/GenFds/FdfParser.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 RefFdName in FdAnalyzedList:
                                                      continue
                          
                          Severity: Major
                          Found in BaseTools/Source/Python/GenFds/FdfParser.py - About 45 mins to fix

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

                                def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None, Dict = {}):
                            Severity: Minor
                            Found in BaseTools/Source/Python/GenFds/FvImageSection.py - About 45 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language