hackedteam/vector-edk

View on GitHub

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]
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 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

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 
    #
Severity: Minor
Found in BaseTools/Source/Python/UPT/Xml/XmlParserMisc.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

    Avoid deeply nested control flow statements.
    Open

                        if SortedArch in NewSectionDict:
                            NewSectionDict[SortedArch] = NewSectionDict[SortedArch] + [Statement]
                        else:
                            NewSectionDict[SortedArch] = [Statement]
                    #
    Severity: Major
    Found in BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if Dep.GetVersion() == GuidVerPair[1]:
                                  Result = True
                                  break
                      else:
      Severity: Major
      Found in BaseTools/Source/Python/UPT/Core/DependencyRules.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 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

                            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 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

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

              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

                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 CheckFileType has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

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

                    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
                    Severity: Minor
                    Found in BaseTools/Source/Python/UPT/Library/Misc.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 Item[0] == ToFile:
                                            break
                                    else:
                    Severity: Major
                    Found in BaseTools/Source/Python/UPT/InstallPkg.py - About 45 mins to fix

                      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)
                      Severity: Minor
                      Found in BaseTools/Source/Python/UPT/InstallPkg.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 (not IsValidInfMoudleTypeList(MoudleTypeList)):
                                                  Logger.Error("InfParser",
                                                               FORMAT_INVALID,
                                                               ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(SectionItem[2]),
                                                               File=self.FullPath, Line=LineNo,
                      Severity: Major
                      Found in BaseTools/Source/Python/UPT/Parser/InfParser.py - About 45 mins to fix

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

                          Avoid deeply nested control flow statements.
                          Open

                                              if (Count == StartPos) and Line.strip() == '/*/':
                                                  Count = Count + 1
                                                  continue
                                              EndPos = Count
                          Severity: Major
                          Found in BaseTools/Source/Python/UPT/Library/Misc.py - About 45 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language