Showing 9,525 of 13,510 total issues
Avoid deeply nested control flow statements. Open
Open
if PcdInDec.TokenCName == PcdItemObj.CName and \
PcdInDec.TokenSpaceGuidCName == PcdItemObj.TokenSpaceGuidCName:
PcdItemObj.SetToken(PcdInDec.TokenValue)
PcdItemObj.SetDatumType(PcdInDec.DatumType)
PcdItemObj.SetSupportArchList([Arch])
Avoid deeply nested control flow statements. Open
Open
if not FeatureFlagRtv[0]:
Logger.Error("InfParser",
ToolError.FORMAT_INVALID,
ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_SYNTAX_INVLID % (FeatureFlagRtv[1]),
File=UiCurrentLine.GetFileName(),
Avoid deeply nested control flow statements. Open
Open
if GuidInDec.GuidCName == PcdItemObj.TokenSpaceGuidCName:
PcdItemObj.SetTokenSpaceGuidValue(GuidInDec.GuidString)
#
# Validate Value.
Avoid deeply nested control flow statements. Open
Open
if LibraryPath == None or LibraryPath == "":
return []
Avoid deeply nested control flow statements. Open
Open
for GuidItemObjArch in __SupportArchList:
if ItemArch == GuidItemObjArch:
#
# ST.ERR_INF_PARSER_ITEM_DUPLICATE
#
Function _GetModuleLibraryInstances
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _GetModuleLibraryInstances(Module, Platform, BuildDatabase, Arch, Target, Toolchain):
Avoid deeply nested control flow statements. Open
Open
for VerItemObjArch in __SupArchList:
if ItemArch == VerItemObjArch:
#
# ST.ERR_INF_PARSER_ITEM_DUPLICATE
#
Avoid deeply nested control flow statements. Open
Open
if not (ValidFile(FullFileName) or ValidFile(UiContent[1])):
Logger.Error("InfParser",
ToolError.FORMAT_INVALID,
ST.ERR_INF_PARSER_BINARY_ITEM_FILE_NOT_EXIST % (UiContent[1]),
File=UiCurrentLine.GetFileName(),
Avoid deeply nested control flow statements. Open
Open
if self.Binaries.has_key((InfBianryUiItemObj)):
BinariesList = self.Binaries[InfBianryUiItemObj]
BinariesList.append((InfBianryUiItemObj, UiComment))
self.Binaries[InfBianryUiItemObj] = BinariesList
else:
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(self, FilePath, RawData, BuildDatabase, Arch='COMMON', Target=None, Toolchain=None):
Avoid deeply nested control flow statements. Open
Open
for PackageItemObjArch in SupArchList:
if ItemArch == PackageItemObjArch:
#
# ST.ERR_INF_PARSER_ITEM_DUPLICATE
#
Avoid deeply nested control flow statements. Open
Open
if Other[:-1] == SubValue[:-1]:
self._LoggerError(ST.ERR_DECPARSE_REDEFINE % (Key, Value[1]))
return
continue
Avoid deeply nested control flow statements. Open
Open
if BlockFlag == -1:
BlockFlag = 1
elif BlockFlag == 1:
BlockFlag = 2
else:
Avoid deeply nested control flow statements. Open
Open
if len(ArchList) >= 1:
SpecialObject.SetSupArchList(ArchList)
else:
Avoid deeply nested control flow statements. Open
Open
if UiContent[0] != 'UI':
Logger.Error("InfParser",
ToolError.FORMAT_INVALID,
ST.ERR_INF_PARSER_BINARY_VER_TYPE % ('UI'),
File=UiCurrentLine.GetFileName(),
Avoid deeply nested control flow statements. Open
Open
if Node in Constructor:
continue
# remove edge e from the graph if Node has no constructor
ConsumedByList[Item].remove(Node)
Function _GetProtocol
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def _GetProtocol(self):
if self._Protocols == None:
#
# tdict is a special kind of dict, used for selecting correct
# protocol defition for given 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
Open
if PcdInDec.TokenCName == PcdItemObj.CName and \
PcdInDec.TokenSpaceGuidCName == PcdItemObj.TokenSpaceGuidCName:
PcdItemObj.SetToken(PcdInDec.TokenValue)
PcdItemObj.SetDatumType(PcdInDec.DatumType)
PcdItemObj.SetSupportArchList([Arch])
Avoid deeply nested control flow statements. Open
Open
if UiContent[3].strip() == '':
Logger.Error("InfParser",
ToolError.FORMAT_INVALID,
ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_MISSING,
File=UiCurrentLine.GetFileName(),
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(self, FilePath, RawData, BuildDataBase, Arch='COMMON', Target=None, Toolchain=None):