hackedteam/vector-edk

View on GitHub

Showing 9,525 of 13,510 total issues

Avoid deeply nested control flow statements.
Open

                        if len(list) == 2:
                            EotGlobalData.gGuidDict[list[0].strip()] = GuidStructureStringToGuidString(list[1].strip())

    
    ## ParseGuidList() method
Severity: Major
Found in BaseTools/Source/Python/Eot/Eot.py - About 45 mins to fix

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

    def ConvertGuid(guid):
        numList = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
        newGuid = ''
        if guid.startswith('g'):
            guid = guid[1:]
    Severity: Minor
    Found in BaseTools/Source/Python/Eot/Parser.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 regex.groups == 1:
                        regions.append((region_type,int(m.group(1),0),0))
                    else:
                        regions.append((region_type,int(m.group(1),0),int(m.group(2),0)))
                else:
    Severity: Major
    Found in ArmPlatformPkg/Scripts/Ds5/cmd_load_symbols.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          for (row, col), line in slashes:
                              if row == lastrow:
                                  continue
                              rows.append(row)
                              lastrow = row
      Severity: Major
      Found in AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/fixdiv.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                        if regex.groups == 1:
                            raise Exception('cmd_load_symbols', "Expect a base address")
                        else:
                            raise Exception('cmd_load_symbols', "Expect a region format as (base,size)")
            
        Severity: Major
        Found in ArmPlatformPkg/Scripts/Ds5/cmd_load_symbols.py - About 45 mins to fix

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

          def convertdir(dir, dirprefix='', nameprefix='', comments=1):
          
              mapnames = os.listdir(dir)
              for mapname in mapnames:
                  mappathname = os.path.join(dir, mapname)
          Severity: Minor
          Found in AppPkg/Applications/Python/Python-2.7.2/Tools/unicode/gencodec.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 sec[0] == sec_no and (sym_offset >= sec[1] and sym_offset < sec[1] + sec[2]):
                                  bPcds.append([m2.groups(0)[0], sec[3], sym_offset, vir_addr, sec_no])
          
          Severity: Major
          Found in BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py - About 45 mins to fix

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

                def parse_pcd_report(self, report_file):
                    pcd_reg = re.compile(" (\*P|\*F|\*M|  ) (\w+)(\ +)\: (.*) \((\w+)\) = (.*)\n")
                    
                    for line in report_file.xreadlines():
                        stripped_line = line.strip()
            Severity: Minor
            Found in ArmPlatformPkg/Scripts/Ds5/build_report.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 signature == FirmwareVolume.CONST_FV_SIGNATURE:
                                        fvs.append((base,0))
                            else:
            Severity: Major
            Found in ArmPlatformPkg/Scripts/Ds5/edk2_debugger.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if tag[-1] == ':':
                                      tag = tag[:-1]
                                  revisions[tag] = rev
              Severity: Major
              Found in AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/logmerge.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    if res is None:
                                        break
                                    emails.append(res.group('email'))
                Severity: Major
                Found in AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/mailerdaemon.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                      for m in reach[mo]:
                                          if m not in reach[mod]:
                                              reach[mod].append(m)
                                              change = 1
                      #
                  Severity: Major
                  Found in AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/pdeps.py - About 45 mins to fix

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

                        def bitmap(self, name, x, y, w, h, text):
                    Severity: Minor
                    Found in AppPkg/Applications/Python/Python-2.7.2/Tools/msi/msilib.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if self.argprops[name] == P_NESTED:
                                                  print >> buf, template % ("extend", "flatten(",
                                                                            name, ")")
                                              else:
                                                  print >> buf, template % ("append", "", name, "")
                      Severity: Major
                      Found in AppPkg/Applications/Python/Python-2.7.2/Tools/compiler/astgen.py - About 45 mins to fix

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

                            def checkforhtml(self, info, url):
                                if info.has_key('content-type'):
                                    ctype = cgi.parse_header(info['content-type'])[0].lower()
                                    if ';' in ctype:
                                        # handle content-type: text/html; charset=iso8859-1 :
                        Severity: Minor
                        Found in AppPkg/Applications/Python/Python-2.7.2/Tools/webchecker/webchecker.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 getargsFormatArgs has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def getargsFormatArgs(self, sep):
                                fmt = ""
                                lst = ""
                                for arg in self.argumentList:
                                    if arg.flags == SelfMode:
                        Severity: Minor
                        Found in AppPkg/Applications/Python/Python-2.7.2/Tools/bgen/bgen/bgenGenerator.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 server has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def server():
                            if len(sys.argv) > 2:
                                port = eval(sys.argv[2])
                            else:
                                port = MY_PORT
                        Severity: Minor
                        Found in AppPkg/Applications/Python/Python-2.7.2/Demo/sockets/throughput.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 link has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def link(self, label, nodename, rel=None, rev=None):
                                if nodename:
                                    if nodename.lower() == '(dir)':
                                        addr = '../dir.html'
                                        title = ''
                        Severity: Minor
                        Found in AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/texi2html.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 TrimEdkSourceCode has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def TrimEdkSourceCode(Source, Target):
                            EdkLogger.verbose("\t%s -> %s" % (Source, Target))
                            CreateDirectory(os.path.dirname(Target))
                        
                            try:
                        Severity: Minor
                        Found in BaseTools/Source/Python/Trim/Trim.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 main has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def main():
                            try:
                                opts, args = getopt.getopt(sys.argv[1:], "n:")
                            except getopt.error, msg:
                                print msg
                        Severity: Minor
                        Found in AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/cvsfiles.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

                        Severity
                        Category
                        Status
                        Source
                        Language