Showing 9,525 of 13,510 total issues
Avoid deeply nested control flow statements. Open
if PatchPcdDict.has_key(Arch):
PatchPcdDict[Arch].append(Statement)
else:
PatchPcdDict[Arch] = [Statement]
return GenSection('PatchPcd', PatchPcdDict)
Function CheckDpDepexSatisfied
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def CheckDpDepexSatisfied(self, DpObj, ReturnCode=DEPEX_CHECK_SUCCESS):
for PkgKey in DpObj.PackageSurfaceArea.keys():
PkgObj = DpObj.PackageSurfaceArea[PkgKey]
if self.CheckPackageDepexSatisfied(PkgObj, DpObj, ReturnCode):
- 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 _AddStandaloneModule
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _AddStandaloneModule(self, Guid, Version, Name, DpGuid=None, \
Function PrepareTest
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def PrepareTest(String):
SectionString = StringToSectionString(String)
ItemList = []
for Item in SectionString:
ValueList = Item[0].split('|')
- 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 IsValidFeatureFlagExp
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def IsValidFeatureFlagExp(Token, Flag=False):
#
# Not do the check right now, keep the implementation for future enhancement.
#
if not Flag:
- 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 ParseDecPcdTailComment
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def ParseDecPcdTailComment (TailCommentList, ContainerFile):
assert(len(TailCommentList) == 1)
TailComment = TailCommentList[0][0]
LineNum = TailCommentList[0][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
Function GetSingleValueOfKeyFromLines
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def GetSingleValueOfKeyFromLines(Lines, Dictionary, CommentCharacter, KeySplitCharacter, \
Function GetStandaloneModule
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def GetStandaloneModule(self, Guid, Version, Name, Path, DpGuid='', DpVersion=''):
Avoid deeply nested control flow statements. Open
if LineNo > Last:
if License:
License += EndOfLine
License += Comment + EndOfLine
HeaderCommentStage = HEADER_COMMENT_LICENSE
Function ToXml
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def ToXml(self, Dict, Key):
if self.UserExtensionSource:
pass
SourcesNodeList = []
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 BuildOptionDict.has_key('COMMON'):
if Statement not in BuildOptionDict['COMMON']:
BuildOptionDict['COMMON'].append(Statement)
else:
BuildOptionDict['COMMON'] = ['## @AsBuilt']
Function GetModInPackage
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def GetModInPackage(self, Guid, Version, Name, Path, PkgGuid='', PkgVersion=''):
Avoid deeply nested control flow statements. Open
if Token in RemoveTokens:
HelpText = HelpText.replace(Token, '')
#
# If no Usage token is present and set Usage to UNDEFINED
Function IsCurrentOp
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def IsCurrentOp(self, OpList):
self.SkipWhitespace()
LetterOp = ["EQ", "NE", "GE", "LE", "GT", "LT", "NOT", "and", "AND",
"or", "OR", "XOR"]
OpMap = {
- 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 Arch in BinaryFile.SupArchList:
if BuildOptionDict.has_key(Arch):
if Statement not in BuildOptionDict[Arch]:
BuildOptionDict[Arch].append(Statement)
else:
Function GenSourceStatement
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def GenSourceStatement(SourceFile, Family, FeatureFlag, TagName=None,
Avoid deeply nested control flow statements. Open
if PcdExDict.has_key(Arch):
PcdExDict[Arch].append(Statement)
else:
PcdExDict[Arch] = [Statement]
return GenSection('PcdEx', PcdExDict)
Function ObjectFactory
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def ObjectFactory(self, CName, FFE, Usage, Notify, HelpStr, IsProtocol):
Function Factor
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def Factor(self):
if self.IsCurrentOp(["("]):
self.Parens += 1
Ret = self.LogicalExpression()
if not self.IsCurrentOp([")"]):
- 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 CheckFileExist
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def CheckFileExist(WorkspaceDir, CheckFilename, ContainerFilename, SectionName, Line, LineNo=-1):