Showing 9,525 of 13,510 total issues
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 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
Function ConvertVariableName
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def ConvertVariableName(VariableName):
VariableName = VariableName.strip()
#
# check for L quoted string
#
- 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:
Avoid deeply nested control flow statements. Open
if SortedArch in NewSectionDict:
NewSectionDict[SortedArch] = NewSectionDict[SortedArch] + [Statement]
else:
NewSectionDict[SortedArch] = [Statement]
#
Avoid deeply nested control flow statements. Open
if Dep.GetVersion() == GuidVerPair[1]:
Result = True
break
else:
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 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
if Token in RemoveTokens:
HelpText = HelpText.replace(Token, '')
#
# If no Usage token is present and set Usage to UNDEFINED
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
for Arch in BinaryFile.SupArchList:
if LibraryClassDict.has_key(Arch):
LibraryClassDict[Arch].append(Statement)
else:
LibraryClassDict[Arch] = ['## @LIB_INSTANCES']
Avoid deeply nested control flow statements. Open
if PatchPcdDict.has_key(Arch):
PatchPcdDict[Arch].append(Statement)
else:
PatchPcdDict[Arch] = [Statement]
return GenSection('PatchPcd', PatchPcdDict)
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 CheckFileType
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def CheckFileType(CheckFilename, ExtName, ContainerFilename, SectionName, Line, LineNo=-1):
Function ConvertVersionToDecimal
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def ConvertVersionToDecimal(StringIn):
if IsValidHexVersion(StringIn):
Value = int(StringIn, 16)
Major = Value >> 16
Minor = Value & 0xFFFF
- 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 Item[0] == ToFile:
break
else:
Function InstallNewPackage
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def InstallNewPackage(WorkspaceDir, Path, CustomPath = False):
if os.path.isabs(Path):
Logger.Info(ST.MSG_RELATIVE_PATH_ONLY%Path)
elif CustomPath:
Logger.Info(ST.MSG_NEW_PKG_PATH)
- 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 (not IsValidInfMoudleTypeList(MoudleTypeList)):
Logger.Error("InfParser",
FORMAT_INVALID,
ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(SectionItem[2]),
File=self.FullPath, Line=LineNo,
Avoid deeply nested control flow statements. Open
if Key[0] not in Keys:
Dictionary[Key[0]] = Value
Keys.append(Key[0])
else:
Dictionary[Key[0]].extend(Value)
Avoid deeply nested control flow statements. Open
if (Count == StartPos) and Line.strip() == '/*/':
Count = Count + 1
continue
EndPos = Count