Showing 9,525 of 13,510 total issues
Avoid deeply nested control flow statements. Open
Open
if ModulePcdSet == None:
FileWrite(File, "")
FileWrite(File, Key)
Avoid deeply nested control flow statements. Open
Open
if IfList[-1][2]:
IfList[-1][1] = False
else:
IfList[-1][2] = True
self.__WipeOffArea.append((IfList[-1][0], (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - 1)))
Avoid deeply nested control flow statements. Open
Open
if FvInFdList != []:
for FvNameInFd in FvInFdList:
LogStr += "FD %s contains FV %s\n" % (RefFdName,FvNameInFd)
if FvNameInFd not in RefFvList:
RefFvList.append(FvNameInFd)
Avoid deeply nested control flow statements. Open
Open
if RefFvName.upper() in self.Profile.FvDict.keys():
FvObj = self.Profile.FvDict[RefFvName.upper()]
else:
continue
self.__GetReferencedFdFvTuple(FvObj, RefFdList, RefFvList)
Avoid deeply nested control flow statements. Open
Open
if ImageObj.SectionAlignment < 0x400:
self.Alignment = str (ImageObj.SectionAlignment)
else:
self.Alignment = str (ImageObj.SectionAlignment / 0x400) + 'K'
Avoid deeply nested control flow statements. Open
Open
if GenFdsGlobalVariable.GetAlignment (Fv.FvAlignment) > GenFdsGlobalVariable.GetAlignment (self.Alignment):
self.Alignment = Fv.FvAlignment
else:
Function _GenerateReport
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _GenerateReport(self, File, Title, Type, BaseAddress, Size=0, FvName=None):
Avoid deeply nested control flow statements. Open
Open
if elementRegionData.endswith(".cap"):
continue
if elementRegionData != None and elementRegionData.upper() not in CapList:
Avoid deeply nested control flow statements. Open
Open
for RegionData in RegionObj.RegionDataList:
if RegionData.endswith(".fv"):
continue
elif RegionData.upper() + 'fv' in GenFds.ImageBinDict.keys():
continue
Avoid deeply nested control flow statements. Open
Open
if os.path.exists(MapFile):
CopyMapFile = os.path.join(OutputPath, ModuleName + '.map')
if not os.path.exists(CopyMapFile) or \
(os.path.getmtime(MapFile) > os.path.getmtime(CopyMapFile)):
shutil.copyfile(MapFile, CopyMapFile)
Function GenSection
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def GenSection(self,OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None, Dict = {}):
Avoid deeply nested control flow statements. Open
Open
if not os.path.exists(FileBeforeStrip) or \
(os.path.getmtime(File) > os.path.getmtime(FileBeforeStrip)):
shutil.copyfile(File, FileBeforeStrip)
StrippedFile = os.path.join(OutputPath, ModuleName + '.stripped')
Avoid deeply nested control flow statements. Open
Open
for SkuInfo in Pcd.SkuInfoList.values():
if TypeName in ('DYNHII', 'DEXHII'):
FileWrite(File, '%*s: %s: %s' % (self.MaxLen + 4, SkuInfo.VariableGuid, SkuInfo.VariableName, SkuInfo.VariableOffset))
else:
FileWrite(File, '%*s' % (self.MaxLen + 4, SkuInfo.VpdOffset))
Avoid deeply nested control flow statements. Open
Open
if Pcd.Type == TAB_PCDS_PATCHABLE_IN_MODULE and Pcd.TokenCName in TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_LIST:
ModuleIsPatch = True
break
Avoid deeply nested control flow statements. Open
Open
if (Arch == 'IA32' or Arch == 'ARM') and self.LoadFixAddress != 0xFFFFFFFFFFFFFFFF and self.LoadFixAddress >= 0x100000000:
EdkLogger.error("build", PARAMETER_INVALID, "FIX_LOAD_TOP_MEMORY_ADDRESS can't be set to larger than or equal to 4G for the platform with IA32 or ARM arch modules")
#
# Get Module List
#
Avoid deeply nested control flow statements. Open
Open
if self.Fdf:
#
# create FDS again for the updated EFI image
#
self._Build("fds", Wa)
Function IsToolInPath
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def IsToolInPath(tool):
if os.environ.has_key('PATHEXT'):
extns = os.environ['PATHEXT'].split(os.path.pathsep)
else:
extns = ('',)
- Read upRead up
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
Open
if GuidString.upper() in ModuleList:
Line = Line.replace(GuidString, ModuleList[GuidString.upper()].Name)
MapBuffer.write('%s' % (Line))
Avoid deeply nested control flow statements. Open
Open
if (Arch == 'IA32' or Arch == 'ARM') and self.LoadFixAddress != 0xFFFFFFFFFFFFFFFF and self.LoadFixAddress >= 0x100000000:
EdkLogger.error("build", PARAMETER_INVALID, "FIX_LOAD_TOP_MEMORY_ADDRESS can't be set to larger than or equal to 4G for the platorm with IA32 or ARM arch modules")
#
# Get Module List
#
Function _Init
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _Init(self, Workspace, ModuleFile, Target, Toolchain, Arch, PlatformFile):