Showing 9,525 of 13,510 total issues
Avoid deeply nested control flow statements. Open
for Key in Module.LibraryClasses:
Lib = Module.LibraryClasses[Key]
if Lib not in Platform.LibraryInstances:
Platform.LibraryInstances.append(Lib)
Function ConvertTextFileToDictionary
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def ConvertTextFileToDictionary(FileName, Dictionary, CommentCharacter, KeySplitCharacter, ValueSplitFlag, ValueSplitCharacter):
Function ConvertTextFileToDictionary
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def ConvertTextFileToDictionary(FileName, Dictionary, CommentCharacter, KeySplitCharacter, ValueSplitFlag, ValueSplitCharacter):
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, Filename=None, IsToDatabase=False, IsToModule=False, WorkspaceDir=None, Database=None, SupArchList=DataType.ARCH_LIST):
Avoid deeply nested control flow statements. Open
for Dec in self.Build[Arch].PackageDatabase:
Pcds = self.Build[Arch].PackageDatabase[Dec].Pcds
if (Name, Guid, PcdType) in Pcds:
Pcd = Pcds[(Name, Guid, PcdType)]
Type = PcdType
Function GenIncludes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def GenIncludes(self, ContainerFile):
EdkLogger.debug(2, "Generate %s ..." % TAB_INCLUDES)
Includes = {}
#
# Get all Includes
- 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 GenUserExtensions
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def GenUserExtensions(self):
UEObj = self.DecParser.GetUserExtensionSectionObject()
UEList = UEObj.GetAllUserExtensions()
for Item in UEList:
if not Item.UserString:
- 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 ModuleTypeInList in DT.VALID_DEPEX_MODULE_TYPE_LIST:
ModuleTypeList.append(ModuleTypeInList)
if not ModuleTypeList:
Avoid deeply nested control flow statements. Open
if Arch in Item.SupArchList:
for ModuleType in Item.SupModuleList:
EdkLogger.debug(EdkLogger.DEBUG_3, "\tLibraryClass %s has specific defined module types" % Name)
if ModuleType in SupModuleList:
SupModuleList.remove(ModuleType)
Avoid deeply nested control flow statements. Open
if ItemList[1] != '' and ItemList[1].upper() not in ARCH_LIST_FULL:
EdkLogger.error("Parser", PARSER_ERROR, "Invalid Arch definition '%s' found" % ItemList[1], File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
ArchList.append(ItemList[1].upper())
Avoid deeply nested control flow statements. Open
for Pcd in Module.PcdBuildDefinitions:
if (Name, Guid) == (Pcd.CName, Pcd.TokenSpaceGuidCName):
if Pcd.DefaultValue != '':
Value = Pcd.DefaultValue
if Pcd.MaxDatumSize != '':
Avoid deeply nested control flow statements. Open
if CurrentSection != ItemList[0]:
EdkLogger.error("Parser", PARSER_ERROR, "Different section names '%s' and '%s' are found in one section definition, this is not allowed." % (CurrentSection, ItemList[0]), File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
if CurrentSection.upper() not in self.KeyList:
Avoid deeply nested control flow statements. Open
if ItemList[1] != '' and ItemList[1].upper() not in ARCH_LIST_FULL:
EdkLogger.error("Parser", PARSER_ERROR, "Invalid Arch definition '%s' found" % ItemList[1], File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
ArchList.append(ItemList[1].upper())
Avoid deeply nested control flow statements. Open
if (Item.ToolChainFamily, Item.ToolChain) not in Pb.BuildOptions:
Pb.BuildOptions[(Item.ToolChainFamily, Item.ToolChain)] = Item.Option
else:
OptionString = Pb.BuildOptions[(Item.ToolChainFamily, Item.ToolChain)]
Pb.BuildOptions[(Item.ToolChainFamily, Item.ToolChain)] = OptionString + " " + Item.Option
Avoid deeply nested control flow statements. Open
for BuildOption in Module.ModuleSaBuildOption.BuildOptionList:
#
# Add to BuildOptions
#
BuildOptions[(BuildOption.ToolChainFamily, BuildOption.ToolChain)] = BuildOption.Option
Function ConvertDictionaryToTextFile
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def ConvertDictionaryToTextFile(self, FileName, Dictionary, CommentCharacter, KeySplitCharacter, ValueSplitFlag, ValueSplitCharacter):
Function ConvertDictionaryToTextFile
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def ConvertDictionaryToTextFile(FileName, Dictionary, CommentCharacter, KeySplitCharacter, ValueSplitFlag, ValueSplitCharacter):
Avoid deeply nested control flow statements. Open
for Node in ConsumedByList[Item]:
if Node not in Constructor:
#
# remove edge e from the graph
#
Function ToXml
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def ToXml(self, Dict, Key):
if self.UserExtensionBinary:
pass
BinariesNodeList = []
for Item in Dict:
- 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 LibraryClassDict.has_key('COMMON'):
LibraryClassDict['COMMON'].append(Statement)
else:
LibraryClassDict['COMMON'] = ['## @LIB_INSTANCES']
LibraryClassDict['COMMON'].append(Statement)