hackedteam/vector-edk

View on GitHub

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)
Severity: Major
Found in BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py - About 45 mins to fix

    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):
    Severity: Minor
    Found in BaseTools/Source/Python/UPT/Core/DependencyRules.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

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

        def _AddStandaloneModule(self, Guid, Version, Name, DpGuid=None, \
    Severity: Minor
    Found in BaseTools/Source/Python/UPT/Core/IpiDb.py - About 45 mins to fix

      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('|')
      Severity: Minor
      Found in BaseTools/Source/Python/UPT/UnitTest/InfBinarySectionTest.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

      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:
      Severity: Minor
      Found in BaseTools/Source/Python/UPT/Library/ExpressionValidate.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

      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]
      
      Severity: Minor
      Found in BaseTools/Source/Python/UPT/Library/CommentParsing.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

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

      def GetSingleValueOfKeyFromLines(Lines, Dictionary, CommentCharacter, KeySplitCharacter, \
      Severity: Minor
      Found in BaseTools/Source/Python/UPT/Library/String.py - About 45 mins to fix

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

            def GetStandaloneModule(self, Guid, Version, Name, Path, DpGuid='', DpVersion=''):
        Severity: Minor
        Found in BaseTools/Source/Python/UPT/Core/IpiDb.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/UPT/Library/CommentParsing.py - About 45 mins to fix

            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:
            Severity: Minor
            Found in BaseTools/Source/Python/UPT/Xml/CommonXml.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 BuildOptionDict.has_key('COMMON'):
                                    if Statement not in BuildOptionDict['COMMON']:
                                        BuildOptionDict['COMMON'].append(Statement)
                                else:
                                    BuildOptionDict['COMMON'] = ['## @AsBuilt']
            Severity: Major
            Found in BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py - About 45 mins to fix

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

                  def GetModInPackage(self, Guid, Version, Name, Path, PkgGuid='', PkgVersion=''):
              Severity: Minor
              Found in BaseTools/Source/Python/UPT/Core/IpiDb.py - About 45 mins to fix

                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
                Severity: Major
                Found in BaseTools/Source/Python/UPT/Library/CommentParsing.py - About 45 mins to fix

                  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 = {
                  Severity: Minor
                  Found in BaseTools/Source/Python/UPT/Library/ExpressionValidate.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

                                      for Arch in BinaryFile.SupArchList:
                                          if BuildOptionDict.has_key(Arch):
                                              if Statement not in BuildOptionDict[Arch]:
                                                  BuildOptionDict[Arch].append(Statement)
                                          else:
                  Severity: Major
                  Found in BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py - About 45 mins to fix

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

                    def GenSourceStatement(SourceFile, Family, FeatureFlag, TagName=None, 
                    Severity: Minor
                    Found in BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          if PcdExDict.has_key(Arch):
                                              PcdExDict[Arch].append(Statement)
                                          else:
                                              PcdExDict[Arch] = [Statement]
                          return GenSection('PcdEx', PcdExDict)
                      Severity: Major
                      Found in BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py - About 45 mins to fix

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

                            def ObjectFactory(self, CName, FFE, Usage, Notify, HelpStr, IsProtocol):
                        Severity: Minor
                        Found in BaseTools/Source/Python/UPT/UnitTest/CommentGeneratingUnitTest.py - About 45 mins to fix

                          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([")"]):
                          Severity: Minor
                          Found in BaseTools/Source/Python/UPT/Library/ExpressionValidate.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

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

                          def CheckFileExist(WorkspaceDir, CheckFilename, ContainerFilename, SectionName, Line, LineNo=-1):
                          Severity: Minor
                          Found in BaseTools/Source/Python/UPT/Library/String.py - About 45 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language