Showing 9,525 of 13,510 total issues
Avoid deeply nested control flow statements. Open
if Input.upper() != 'Y':
continue
RemovePath(Path)
Avoid deeply nested control flow statements. Open
if not Line.startswith(DT.TAB_COMMENT_SPLIT):
Logger.Warn("Parser",
ST.WARN_SPECIAL_SECTION_LOCATION_WRONG,
File=self.FullPath, Line=LineNum)
SpecialSectionStart = False
Avoid deeply nested control flow statements. Open
if Package and ((ToFile, Md5Sum) not in Package.FileList):
Package.FileList.append((ToFile, Md5Sum))
elif Package:
continue
elif (ToFile, Md5Sum) not in Module.FileList:
Function GetToken
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def GetToken(self, StopChar='.,|\t ', SkipPair='"'):
self.__SkipWhitespace()
PreIndex = self._Index
InQuote = False
LastChar = ''
- 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 Count % 2 != 0:
QuotedStringList[Count-1] = QuotedStringList[Count-1].replace("$(%s)" % Macro,
MacroDefinitions[Macro])
elif Count == len(QuotedStringList) and Count%2 == 0:
QuotedStringList[Count-1] = QuotedStringList[Count-1].replace("$(%s)" % Macro,
Avoid deeply nested control flow statements. Open
if MatchObject:
CheckLocation = False
elif Line:
Logger.Warn("Parser",
ST.WARN_SPECIAL_SECTION_LOCATION_WRONG,
Avoid deeply nested control flow statements. Open
if IsValidPath(UiContent[1], GlobalData.gINF_MODULE_DIR):
IsValidFileFlag = True
else:
Logger.Error("InfParser",
ToolError.FORMAT_INVALID,
Avoid deeply nested control flow statements. Open
for ProtocolItemObjArch in __SupArchList:
if ItemArch == ProtocolItemObjArch:
#
# ST.ERR_INF_PARSER_ITEM_DUPLICATE
#
Avoid deeply nested control flow statements. Open
if BlockFlag == 1 or BlockFlag == 2:
BlockFlag = 3
elif BlockFlag == -1:
BlockFlag = 4
Avoid deeply nested control flow statements. Open
if Num == 0:
Line = "%-30s = \n" % Key
else:
ret = GetConfigureKeyValue(self, Key)
if ret != None:
Avoid deeply nested control flow statements. Open
if CommentItemUsage == CommentItemGuidType == DT.ITEM_UNDEFINED:
BlockFlag = 4
else:
BlockFlag = 3
if BlockFlag == -1:
Function SetSpecialComments
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def SetSpecialComments(self, SepcialSectionList = None, Type = ''):
if Type == DT.TYPE_HOB_SECTION or \
Type == DT.TYPE_EVENT_SECTION or \
Type == DT.TYPE_BOOTMODE_SECTION:
for Item in SepcialSectionList:
- 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 IsValidFileFlag:
UiContent[0] = ConvPathFromAbsToRel(UiContent[0], GlobalData.gINF_MODULE_DIR)
InfBianryUiItemObj.SetFileName(UiContent[1])
if len(UiContent) >= 3:
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, File, RawData, BuildDataBase, Arch='COMMON', Target=None, Toolchain=None):
Avoid deeply nested control flow statements. Open
if IsValidLibName(LibItem[0].strip()):
if LibItem[0].strip() != 'NULL':
LibItemObj.SetLibName(LibItem[0])
else:
Logger.Error("InfParser",
Function SetSources
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def SetSources(self, SourceList, Arch = None):
__SupArchList = []
for ArchItem in Arch:
#
# Validate Arch
- 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 ConsumedByList[Item] == []:
# insert Item into Q
Q.insert(0, Item)
break
if Q != []:
Avoid deeply nested control flow statements. Open
if Key not in existKeys:
existKeys.append(Key)
else:
print "Warning: Found duplicate key item in original configuration files!"
Avoid deeply nested control flow statements. Open
if LibraryName.upper() == Key.upper():
Library = Platform.LibraryClasses[Key, ':dummy:']
break
if Library == None:
Avoid deeply nested control flow statements. Open
for PpiItemObjArch in __SupArchList:
if ItemArch == PpiItemObjArch:
#
# ST.ERR_INF_PARSER_ITEM_DUPLICATE
#