Showing 9,525 of 13,510 total issues
Avoid deeply nested control flow statements. Open
if Token not in self.SupportedOperand:
self.PostfixNotation.append("PUSH")
# check if OP is valid in this phase
elif Token in self.Opcode[self.Phase]:
Avoid deeply nested control flow statements. Open
if InfDefaultValue == None:
InfMatch = True
else:
InfMatch = (InfDefaultValue.strip() == PcdValue.strip())
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, BaseName, Guid, Arch, OutputDir, DebugDir, ImageClass):
Avoid deeply nested control flow statements. Open
if DscMatch:
if (Pcd.TokenCName, Key) in self.FdfPcdSet:
FileWrite(File, ' *F %-*s: %6s %10s = %-22s' % (self.MaxLen, Pcd.TokenCName, TypeName, '('+Pcd.DatumType+')', PcdValue.strip()))
else:
FileWrite(File, ' *P %-*s: %6s %10s = %-22s' % (self.MaxLen, Pcd.TokenCName, TypeName, '('+Pcd.DatumType+')', PcdValue.strip()))
Avoid deeply nested control flow statements. Open
if FvName in self._FvList:
continue
self._FvList.append(FvName)
Function _GetLibraryList
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _GetLibraryList(self):
if self._DependentLibraryList == None:
# only merge library classes and PCD for non-library module
if self.IsLibrary:
self._DependentLibraryList = []
- 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
Function Generate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def Generate(self, File=None):
Buffer = StringIO()
if len(self.PostfixNotation) == 0:
return False
- 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
for ModulePath in ModuleOverride:
ModuleDefault = ModuleOverride[ModulePath]
if Pcd.DatumType in ('UINT8', 'UINT16', 'UINT32', 'UINT64'):
ModulePcdDefaultValueNumber = int(ModuleDefault.strip(), 0)
Match = (ModulePcdDefaultValueNumber == PcdValueNumber)
Function PlaceMacro
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def PlaceMacro(self, Path, MacroDefinitions={}):
if Path.startswith("$("):
return Path
else:
PathLength = len(Path)
- 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
if attrib.upper().endswith('_GUID'):
split = attrib.split('_')
thisPrefix = '_'.join(split[0:3]) + '_'
if thisPrefix == prefix:
guid = self.ToolDef.ToolsDefTxtDictionary[attrib]
Avoid deeply nested control flow statements. Open
if HeaderType in gIncludeMacroConversion:
Inc = gIncludeMacroConversion[HeaderType] % {"HeaderKey" : HeaderKey}
else:
# not known macro used in #include, always build the file by
# returning a empty dependency
Avoid deeply nested control flow statements. Open
if not gIsFileMap[FilePath]:
continue
# If isfile is called too many times, the performance is slow down.
elif not os.path.isfile(FilePath):
Function GetStringObject
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def GetStringObject(self, Item):
Language = ''
Value = ''
Name = Item.split()[1]
- 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
for Ffs in Wa.FdfProfile.FvDict[FvName.upper()].FfsList:
for Section in Ffs.SectionList:
try:
for FvSection in Section.SectionList:
if FvSection.FvName in self._FvList:
Avoid deeply nested control flow statements. Open
if StrList[3] == 'f' or StrList[3] =='F':
Name = StrList[1]
RelativeAddress = int (StrList[2], 16) - OrigImageBaseAddress
FunctionList.append ((Name, RelativeAddress))
if ModuleInfo.Arch == 'IPF' and Name.endswith('_ModuleEntryPoint'):
Avoid deeply nested control flow statements. Open
for Pa in self.AutoGenObjectList:
if not PcdFoundFlag:
for PcdItem in Pa.AllPcdList:
if (PcdItem.TokenSpaceGuidCName + "." + PcdItem.TokenCName) == _PcdName:
#
Avoid deeply nested control flow statements. Open
while (SameTokenValuePcdListCount < len(SameTokenValuePcdList) - 1):
TemListItem = SameTokenValuePcdList[SameTokenValuePcdListCount]
TemListItemNext = SameTokenValuePcdList[SameTokenValuePcdListCount + 1]
if (TemListItem.TokenSpaceGuidCName == TemListItemNext.TokenSpaceGuidCName) and (TemListItem.TokenCName != TemListItemNext.TokenCName):
Avoid deeply nested control flow statements. Open
if Sku.DefaultValue == 'TRUE':
Pcd.InitString = 'INIT'
else:
if int(Sku.DefaultValue, 0) != 0:
Pcd.InitString = 'INIT'
Avoid deeply nested control flow statements. Open
for VpdPcd in VpdFile._VpdArray.keys():
# This PCD has been referenced by module
if (VpdPcd.TokenSpaceGuidCName == DscPcdEntry.TokenSpaceGuidCName) and \
(VpdPcd.TokenCName == DscPcdEntry.TokenCName):
FoundFlag = True
Avoid deeply nested control flow statements. Open
if Tool == "MAKE":
if Attr == "FLAGS":
MakeFlags = Value
else:
ToolsDef += "%s_%s = %s\n" % (Tool, Attr, Value)