hackedteam/vector-edk

View on GitHub

Showing 9,525 of 13,510 total issues

Avoid deeply nested control flow statements.
Open

                    if TmpStr.startswith(PredVarStr):
                        IsFuncCall = True
Severity: Major
Found in BaseTools/Source/Python/Ecc/c.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if Id < 0:
                                continue
                            FileTable = 'Identifier' + str(Id)
    Severity: Major
    Found in BaseTools/Source/Python/Ecc/Check.py - About 45 mins to fix

      Function UpdateIdentifierBelongsToFunction_disabled has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def UpdateIdentifierBelongsToFunction_disabled(self):
              EdkLogger.verbose("Update 'BelongsToFunction' for Identifiers started ...")
      
              SqlCommand = """select ID, BelongsToFile, StartLine, EndLine, Model from Identifier"""
              EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand)
      Severity: Minor
      Found in BaseTools/Source/Python/Ecc/Database.py - About 45 mins to fix

      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 DiffModifier(ParamListOfDef[Index].Modifier, ParamListOfDecl[Index].Modifier) and not EccGlobalData.gException.IsException(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_PROTO_TYPE_3, FuncName):
                              PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_PROTO_TYPE_3, 'Parameter %s has different modifier with prototype in function [%s].' % (ParamListOfDef[Index].Name, FuncName), 'Function', FuncDef[3])
                          Index += 1
      Severity: Major
      Found in BaseTools/Source/Python/Ecc/c.py - About 45 mins to fix

        Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(self, ModifierStr, DeclStr, Begin, End, LBPos, NamePos):
        Severity: Minor
        Found in BaseTools/Source/Python/Ecc/CodeFragment.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if Path.startswith('\\') or Path.startswith('/'):
                                      Path = Path[1:]
                                  if not EccGlobalData.gException.IsException(ERROR_INCLUDE_FILE_CHECK_NAME, Path):
          Severity: Major
          Found in BaseTools/Source/Python/Ecc/Check.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                if LineNo > Last:
                                    if License:
                                        License += EndOfLine
                                    License += Comment + EndOfLine
                                    HeaderCommentStage = HEADER_COMMENT_LICENSE                
            Severity: Major
            Found in BaseTools/Source/Python/Ecc/MetaDataParser.py - About 45 mins to fix

              Function StoreTypedefDefinition has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def StoreTypedefDefinition(self, StartLine, StartOffset, EndLine, EndOffset, FromText, ToText):
              Severity: Minor
              Found in BaseTools/Source/Python/Ecc/CParser.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    if Tag.find('[' + InOutStr + ']') == -1:
                                        if InOutStr != 'in, out':
                                            ErrorMsgList.append('Line %d : in Comment, <%s> does NOT have %s ' % (CommentStartLine, (TagPartList[0] + ' ' + TagPartList[1]).replace('\n', '').replace('\r', ''), '[' + InOutStr + ']'))
                                            PrintErrorMsg(ERROR_DOXYGEN_CHECK_FUNCTION_HEADER, 'in Comment, <%s> does NOT have %s ' % ((TagPartList[0] + ' ' + TagPartList[1]).replace('\n', '').replace('\r', ''), '[' + InOutStr + ']'), TableName, CommentId)
                                        else:
                Severity: Major
                Found in BaseTools/Source/Python/Ecc/c.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if Record[1] not in AllStructure.keys():
                                              AllStructure[Record[1]] = Record[2]
                                          else:
                                              ID = AllStructure[Record[1]]
                                              SqlCommand = """select FullPath from File where ID = %s """ % ID
                  Severity: Major
                  Found in BaseTools/Source/Python/Ecc/Check.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                        if RefLine.strip() == False or RefLine.strip().startswith('**/'):
                                            RefListFlag = False
                                            break
                                        # Check whether C File header Comment's each reference at list should begin with a bullet character.
                                        if EccGlobalData.gConfig.HeaderCheckCFileCommentReferenceFormat == '1' or EccGlobalData.gConfig.HeaderCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
                    Severity: Major
                    Found in BaseTools/Source/Python/Ecc/c.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_TYPEDEF_STATEMENT, Name):
                                                  EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_TYPEDEF_STATEMENT, OtherMsg="The #typedef name [%s] does not follow the rules" % (Name), BelongsToTable=FileTable, BelongsToItem=Record[0])
                      
                          # Check whether the #ifndef at the start of an include file uses both prefix and postfix underscore characters, '_'.
                          def NamingConventionCheckIfndefStatement(self, FileTable):
                      Severity: Major
                      Found in BaseTools/Source/Python/Ecc/Check.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                if HeaderCommentEnd == False:
                                                    SqlStatement = """ select ID from File where FullPath like '%s'""" % FullName
                                                    ResultSet = EccGlobalData.gDb.TblFile.Exec(SqlStatement)
                                                    for Result in ResultSet:
                                                        Msg = 'INF/DEC/DSC/FDF file header comment should end with ""##"" at the end of file header comment block'
                        Severity: Major
                        Found in BaseTools/Source/Python/Ecc/Check.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                  if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_1, Record[1]):
                                                      EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_1, OtherMsg="The type of Library Class [%s] defined in Inf file does not match the type of the module" % (Record[1]), BelongsToTable='Inf', BelongsToItem=Record[0])
                                          else:
                          Severity: Major
                          Found in BaseTools/Source/Python/Ecc/Check.py - About 45 mins to fix

                            Function StoreVariableDeclaration has 6 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                def StoreVariableDeclaration(self, StartLine, StartOffset, EndLine, EndOffset, ModifierText, DeclText):
                            Severity: Minor
                            Found in BaseTools/Source/Python/Ecc/CParser.py - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                  if Type != None:
                                                      if Type.find('*') != -1 and Type != 'BOOLEAN*':
                                                          PrintErrorMsg(ERROR_PREDICATE_EXPRESSION_CHECK_COMPARISON_NULL_TYPE, 'Predicate Expression: %s' % Exp, FileTable, Str[2])
                                                      continue
                              
                              Severity: Major
                              Found in BaseTools/Source/Python/Ecc/c.py - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                        for Line in FileLinesList:
                                                            LineNo   = LineNo + 1
                                                            Line     = Line.strip()
                                                            if (LineNo < len(FileLinesList) - 1):
                                                                NextLine = FileLinesList[LineNo].strip()
                                Severity: Major
                                Found in BaseTools/Source/Python/Ecc/Check.py - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                          if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_LIBRARY_NAME_DUPLICATE, Record[1]):
                                                              EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_NAME_DUPLICATE, OtherMsg="The Library Class [%s] is duplicated in '%s' line %s and line %s." % (Record[1], FilePath, Record[3], Record[4]), BelongsToTable='Dsc', BelongsToItem=Record[0])
                                                                                  
                                      # Check whether an Inf file is specified in the FDF file, but not in the Dsc file, then the Inf file must be for a Binary module only
                                      def MetaDataFileCheckBinaryInfInFdf(self):
                                  Severity: Major
                                  Found in BaseTools/Source/Python/Ecc/Check.py - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                        if Index == -1:
                                                            PrintErrorMsg(ERROR_DOXYGEN_CHECK_COMMAND, 'Unknown doxygen command %s' % Part, FileTable, Result[1])
                                                        RealCmd = Part[1:Index]
                                    Severity: Major
                                    Found in BaseTools/Source/Python/Ecc/c.py - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                              if HeaderCommentStart == False:
                                                                  SqlStatement = """ select ID from File where FullPath like '%s'""" % FullName
                                                                  ResultSet = EccGlobalData.gDb.TblFile.Exec(SqlStatement)
                                                                  for Result in ResultSet:
                                                                      Msg = 'INF/DEC/DSC/FDF file header comment should begin with ""## @file"" or ""# @file"" at the very top file'
                                      Severity: Major
                                      Found in BaseTools/Source/Python/Ecc/Check.py - About 45 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language