Showing 9,525 of 13,510 total issues
Avoid deeply nested control flow statements. Open
Open
if StringTableIndex == 0:
Dict['STRING_TABLE_INDEX'].append('')
else:
Dict['STRING_TABLE_INDEX'].append('_%d' % StringTableIndex)
if Sku.DefaultValue[0] == 'L':
Avoid deeply nested control flow statements. Open
Open
if ConsumedByList[Item] == []:
# insert Item into Q
Q.insert(0, Item)
break
if Q != []:
Function GetIntegerValue
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def GetIntegerValue(Input):
if type(Input) in (int, long):
return Input
String = Input
if String.endswith("U"):
- 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 Sku.DefaultValue[0] == 'L':
DefaultValueBinStructure = StringToArray(Sku.DefaultValue)
Size = len(DefaultValueBinStructure.replace(',',' ').split())
Dict['STRING_TABLE_VALUE'].append(DefaultValueBinStructure)
elif Sku.DefaultValue[0] == '"':
Avoid deeply nested control flow statements. Open
Open
if Dict['TOKEN_CNAME'][Count] == Dict['SIZE_TABLE_CNAME'][Count1] and \
Dict['TOKEN_GUID'][Count] == Dict['SIZE_TABLE_GUID'][Count1]:
SizeCNameTempList.append(Dict['SIZE_TABLE_CNAME'][Count1])
SizeGuidTempList.append(Dict['SIZE_TABLE_GUID'][Count1])
SizeCurLenTempList.append(Dict['SIZE_TABLE_CURRENT_LENGTH'][Count1])
Function Insert
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def Insert(self, Name, ExtName, Path, FullPath, Model, TimeStamp):
Avoid deeply nested control flow statements. Open
Open
if Arch == self.Arch or Arch == "*":
if Options[Key].startswith("="):
if OverrideList.get(Key[1]) != None:
OverrideList.pop(Key[1])
OverrideList[Key[1]] = Options[Key]
Function __init__
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def __init__(self, ItemSize, DataList=None, RawDataList=None, LenList=None):
if DataList is None:
DataList = []
if RawDataList is None:
RawDataList = []
- 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
for UniLanguage in UniLanguageList:
if UniLanguage.startswith('en-') or UniLanguage.startswith('eng-'):
if UniLanguage not in UniLanguageListFiltered:
UniLanguageListFiltered += [UniLanguage]
break
Avoid deeply nested control flow statements. Open
Open
if DeclSplitList[0][Index:].startswith('EFIAPI'):
Index += 6
FuncNameStartColumn += 6
PreChar = ''
continue
Avoid deeply nested control flow statements. Open
Open
if Tool == "MAKE":
MakePath = Value
else:
ToolsDef += "%s = %s\n" % (Tool, Value)
elif Attr != "DLL":
Avoid deeply nested control flow statements. Open
Open
if ToolChain1 == ToolChain2 or ToolChain1 == "*" or ToolChain2 == "*":
if Arch1 == Arch2 or Arch1 == "*" or Arch2 == "*":
if CommandType1 == CommandType2 or CommandType1 == "*" or CommandType2 == "*":
if Attr1 == Attr2 or Attr1 == "*" or Attr2 == "*":
if self.CalculatePriorityValue(NowKey) > self.CalculatePriorityValue(NextKey):
Avoid deeply nested control flow statements. Open
Open
if DepexList[-1] == 'END': # no need of a END at this time
DepexList.pop()
DepexList.append(')')
Avoid deeply nested control flow statements. Open
Open
if FixedAtBuildPcds[key] != Pcd.DefaultValue:
ShareFixedAtBuildPcdsSameValue[key] = False
for Pcd in LibAuto.FixedAtBuildPcds:
Avoid deeply nested control flow statements. Open
Open
if ToolDef.has_key("GUID") and ToolDef["GUID"] == self.Platform.VpdToolGuid:
if not ToolDef.has_key("PATH"):
EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE, "PATH attribute was not provided for BPDG guid tool %s in tools_def.txt" % self.Platform.VpdToolGuid)
BPDGToolName = ToolDef["PATH"]
break
Avoid deeply nested control flow statements. Open
Open
if Unicode:
Padding = Padding * 2
ArraySize = ArraySize / 2
if ArraySize < (len(PcdValue) + 1):
Avoid deeply nested control flow statements. Open
Open
if Type != None:
if Type.find('BOOLEAN') == -1:
PrintErrorMsg(ERROR_PREDICATE_EXPRESSION_CHECK_NO_BOOLEAN_OPERATOR, 'Predicate Expression: %s' % Exp, FileTable, Str[2])
continue
Avoid deeply nested control flow statements. Open
Open
if Type != None:
if Type.find('BOOLEAN') != -1:
PrintErrorMsg(ERROR_PREDICATE_EXPRESSION_CHECK_BOOLEAN_VALUE, 'Predicate Expression: %s' % Exp, FileTable, Str[2])
continue
Avoid deeply nested control flow statements. Open
Open
if Item not in LibraryClasses[List[0]]:
LibraryClasses[List[0]].append(Item)
Avoid deeply nested control flow statements. Open
Open
if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_DEPENDENT, LibraryClass[1]):
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_DEPENDENT, OtherMsg="The Library Class [%s] is not specified in '%s'" % (LibraryClass[1], LibraryClass[2]), BelongsToTable='Dsc', BelongsToItem=LibraryClass[0])
# Check whether the Library Instances specified by the LibraryClasses sections are listed in order of dependencies
def MetaDataFileCheckLibraryInstanceOrder(self):