Showing 9,525 of 13,510 total issues
Avoid deeply nested control flow statements. Open
Open
if self.BuildOption[Tool][Attr].startswith('='):
Value = self.BuildOption[Tool][Attr][1:]
else:
Value += " " + self.BuildOption[Tool][Attr]
Avoid deeply nested control flow statements. Open
Open
if Comment.find(Usage) != -1:
UsageIndex = Index
break
if UsageIndex != -1:
Avoid deeply nested control flow statements. Open
Open
if Pcd.MaxDatumSize != '':
MaxDatumSize = int(Pcd.MaxDatumSize, 0)
if MaxDatumSize < Size:
EdkLogger.error("build", AUTOGEN_ERROR,
"The maximum size of VOID* type PCD '%s.%s' is less than its actual size occupied." % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName),
Avoid deeply nested control flow statements. Open
Open
if Sku.DefaultValue in ["1", "0"]:
ValueList.append(Sku.DefaultValue + "U")
else:
Avoid deeply nested control flow statements. Open
Open
while Index < NameStart:
FirstChar = DeclSplitList[0][Index]
if DeclSplitList[0][Index:].startswith('EFIAPI'):
Index += 6
VarNameStartColumn += 6
Avoid deeply nested control flow statements. Open
Open
for Module in Pa.ModuleAutoGenList:
if path.normpath(Module.MetaFile.File) == path.normpath(FfsFile.InfFileName):
InfFoundFlag = True
if not Module.Guid.upper() in _GuidDict.keys():
_GuidDict[Module.Guid.upper()] = FfsFile
Avoid deeply nested control flow statements. Open
Open
if Tool not in BuildOptions:
BuildOptions[Tool] = {}
if Attr != "FLAGS" or Attr not in BuildOptions[Tool]:
Avoid deeply nested control flow statements. Open
Open
if len(Type.strip()) == 0:
Type = TypeList[-2]
TypedefDict = GetTypedefDict(FullFileName)
Avoid deeply nested control flow statements. Open
Open
if self.ModuleType != self.BuildType:
RuleObject = BuildRuleDatabase[Type, self.ModuleType, self.Arch, self.ToolChainFamily]
if not RuleObject:
Avoid deeply nested control flow statements. Open
Open
for Index in range(0, len(PcdValue)):
if Unicode:
CharVal = ord(PcdValue[Index])
NewValue = NewValue + '0x%02x' % (CharVal & 0x00FF) + ', ' \
+ '0x%02x' % (CharVal >> 8) + ', '
Avoid deeply nested control flow statements. Open
Open
if UniLanguage not in UniLanguageListFiltered:
UniLanguageListFiltered += [UniLanguage]
break
Avoid deeply nested control flow statements. Open
Open
if Sku.VpdOffset == '':
VoidStarTypeCurrSize.append(str(Size) + 'U')
Dict['STRING_TABLE_LENGTH'].append(StringTabLen)
Avoid deeply nested control flow statements. Open
Open
if FfsFile.InfFileName.find('$') == -1:
InfPath = NormPath(FfsFile.InfFileName)
if not os.path.exists(InfPath):
EdkLogger.error('build', GENFDS_ERROR, "Non-existant Module %s !" % (FfsFile.InfFileName))
Avoid deeply nested control flow statements. Open
Open
if Attr != "FLAGS" or Attr not in BuildOptions[Tool]:
BuildOptions[Tool][Attr] = Options[Key]
else:
# append options for the same tool
BuildOptions[Tool][Attr] += " " + Options[Key]
Avoid deeply nested control flow statements. Open
Open
if ArraySize > len(PcdValue) + 1:
NewValue = NewValue + Padding * (ArraySize - len(PcdValue) - 1)
PcdValue = NewValue + Padding.strip().rstrip(',') + '}'
Function GetStringFiles
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def GetStringFiles(UniFilList, SourceFileList, IncludeList, IncludePathList, SkipList, BaseName, IsCompatibleMode = False, ShellMode = False, UniGenCFlag = True, UniGenBinBuffer = None, FilterInfo = [True, []]):
if len(UniFilList) > 0:
if ShellMode:
#
# support ISO 639-2 codes in .UNI files of EDK Shell
- 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 (Pcd[0], Pcd[1], Type) in Package.Pcds:
EdkLogger.error(
'build',
FORMAT_INVALID,
"Type [%s] of PCD [%s.%s] in DSC file doesn't match the type [%s] defined in DEC file." \
Avoid deeply nested control flow statements. Open
Open
if LibraryPath == None or LibraryPath == "":
EdkLogger.error("build", RESOURCE_NOT_AVAILABLE,
"Instance of library class [%s] is not found" % LibraryClassName,
File=self.MetaFile,
ExtraData="in [%s] [%s]\n\tconsumed by module [%s]" % (str(M), self.Arch, str(Module)))
Avoid deeply nested control flow statements. Open
Open
if LibraryName.upper() == Key.upper():
Library = self.Platform.LibraryClasses[Key, ':dummy:']
break
if Library == None:
Function CreateCode
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def CreateCode(Info, AutoGenC, AutoGenH, StringH, UniGenCFlag, UniGenBinBuffer):