Showing 9,525 of 13,510 total issues
Function __GetAprioriSection
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __GetAprioriSection(self, FvObj, MacroDict = {}):
if not self.__IsKeyword( "APRIORI"):
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
if NotFlag:
ConditionSatisfied = not ConditionSatisfied
BranchDetermined = ConditionSatisfied
Function __GetRegionCapType
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __GetRegionCapType(self, RegionObj):
if not self.__IsKeyword("CAPSULE"):
raise Warning("expected Keyword 'CAPSULE' at line", self.FileName, self.CurrentLineNumber)
- 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 __GetFvAttributes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __GetFvAttributes(self, FvObj):
while self.__GetNextWord():
name = self.__Token
if name not in ("ERASE_POLARITY", "MEMORY_MAPPED", \
- 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 CheckFileType
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def CheckFileType(CheckFilename, ExtName, ContainerFilename, SectionName, Line, LineNo= -1):
Avoid deeply nested control flow statements. Open
if NotFlag:
ConditionSatisfied = not ConditionSatisfied
BranchDetermined = ConditionSatisfied
Avoid deeply nested control flow statements. Open
for FvObj in FvInFdList:
LogStr += FvObj
LogStr += ' \n'
if FvObj not in RefFvStack:
RefFvStack.append(FvObj)
Avoid deeply nested control flow statements. Open
for LibraryClass in Module.LibraryClasses.LibraryList:
if LibraryClass.Name == Lib:
return LibraryClass.FilePath
#
#Second find if exist in <LibraryClass> of <LibraryClasses> from dsc file
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())
Function ParseDefineMacro2
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def ParseDefineMacro2(Table, RecordSets, GlobalMacro):
Macros = {}
#
# Find all DEFINE macros in section [Header] and its section
#
- 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 BuildOption in Module.ModuleSaBuildOption.BuildOptionList:
#
# Add to BuildOptions
#
BuildOptions[(BuildOption.ToolChainFamily, BuildOption.ToolChain)] = BuildOption.Option
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, Filename=None, IsToDatabase=False, IsToPackage=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
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)
Avoid deeply nested control flow statements. Open
for CommentItem in CommentList:
Pcd = CommonObject.PcdObject()
Pcd.SetCName(PcdItemObj.GetCName())
Pcd.SetTokenSpaceGuidCName(PcdItemObj.GetTokenSpaceGuidCName())
Pcd.SetDefaultValue(PcdItemObj.GetDefaultValue())
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:
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
if self._VpdArray[VpdObject][VpdObject.SkuInfoList.keys().index(sku)] == "*":
if Offset == "*":
EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, "The offset of %s has not been fixed up by third-party BPDG tool." % PcdName)
self._VpdArray[VpdObject][VpdObject.SkuInfoList.keys().index(sku)] = Offset
Found = True