hackedteam/vector-edk

View on GitHub
AppPkg/Applications/Python/Python-2.7.2/Lib/pdb.py

Summary

Maintainability
F
3 mos
Test Coverage

File pdb.py has 1064 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#! /usr/bin/env python

"""A Python debugger."""

# (See pdb.doc for documentation.)
Severity: Major
Found in AppPkg/Applications/Python/Python-2.7.2/Lib/pdb.py - About 2 days to fix

    Pdb has 100 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Pdb(bdb.Bdb, cmd.Cmd):
    
        def __init__(self, completekey='tab', stdin=None, stdout=None, skip=None):
            bdb.Bdb.__init__(self, skip=skip)
            cmd.Cmd.__init__(self, completekey, stdin, stdout)
    Severity: Major
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/pdb.py - About 1 day to fix

      Function do_break has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
      Open

          def do_break(self, arg, temporary = 0):
              # break [ ([filename:]lineno | function) [, "condition"] ]
              if not arg:
                  if self.breaks:  # There's at least one
                      print >>self.stdout, "Num Type         Disp Enb   Where"
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/pdb.py - About 5 hrs 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 do_list has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
      Open

          def do_list(self, arg):
              self.lastcmd = 'list'
              last = None
              if arg:
                  try:
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/pdb.py - About 3 hrs 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 do_clear has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          def do_clear(self, arg):
              """Three possibilities, tried in this order:
              clear -> clear all breaks, ask for confirmation
              clear file:lineno -> clear all breaks at file:lineno
              clear bpno bpno ... -> clear breakpoints by number"""
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/pdb.py - About 2 hrs 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 lineinfo has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def lineinfo(self, identifier):
              failed = (None, None, None)
              # Input is identifier, may be in single quotes
              idstring = identifier.split("'")
              if len(idstring) == 1:
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/pdb.py - About 1 hr 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 12 (exceeds 5 allowed). Consider refactoring.
      Open

      def main():
          if not sys.argv[1:] or sys.argv[1] in ("--help", "-h"):
              print "usage: pdb.py scriptfile [arg] ..."
              sys.exit(2)
      
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/pdb.py - About 1 hr 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 do_ignore has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def do_ignore(self,arg):
              """arg is bp number followed by ignore count."""
              args = arg.split()
              try:
                  bpnum = int(args[0].strip())
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/pdb.py - About 1 hr 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 __init__ has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def __init__(self, completekey='tab', stdin=None, stdout=None, skip=None):
              bdb.Bdb.__init__(self, skip=skip)
              cmd.Cmd.__init__(self, completekey, stdin, stdout)
              if stdout:
                  self.use_rawinput = 0
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/pdb.py - About 1 hr 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 lookupmodule has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def lookupmodule(self, filename):
              """Helper function for break/clear parsing -- may be overridden.
      
              lookupmodule() translates (possibly incomplete) file or module name
              into an absolute file name.
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/pdb.py - About 55 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 bp_commands has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def bp_commands(self,frame):
              """Call every command that was set for the current active breakpoint
              (if there is one).
      
              Returns True if the normal interaction function must be called,
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/pdb.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 do_whatis has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def do_whatis(self, arg):
              try:
                  value = eval(arg, self.curframe.f_globals,
                                  self.curframe_locals)
              except:
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/pdb.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 execRcLines has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def execRcLines(self):
              if self.rcLines:
                  # Make local copy because of recursion
                  rcLines = self.rcLines
                  # executed only once
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/pdb.py - About 35 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 do_disable has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def do_disable(self, arg):
              args = arg.split()
              for i in args:
                  try:
                      i = int(i)
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/pdb.py - About 35 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 help has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def help():
          for dirname in sys.path:
              fullname = os.path.join(dirname, 'pdb.doc')
              if os.path.exists(fullname):
                  sts = os.system('${PAGER-more} '+fullname)
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/pdb.py - About 35 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 precmd has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def precmd(self, line):
              """Handle alias expansion and ';;' separator."""
              if not line.strip():
                  return line
              args = line.split()
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/pdb.py - About 35 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 do_enable has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def do_enable(self, arg):
              args = arg.split()
              for i in args:
                  try:
                      i = int(i)
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/pdb.py - About 35 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 handle_command_def has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def handle_command_def(self,line):
              """Handles one command line during command list definition."""
              cmd, arg, line = self.parseline(line)
              if not cmd:
                  return
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/pdb.py - About 35 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 too many return statements within this function.
      Open

              return None
      Severity: Major
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/pdb.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return
        Severity: Major
        Found in AppPkg/Applications/Python/Python-2.7.2/Lib/pdb.py - About 30 mins to fix

          Function checkline has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def checkline(self, filename, lineno):
                  """Check whether specified line seems to be executable.
          
                  Return `lineno` if it is, 0 if not (e.g. a docstring, comment, blank
                  line or EOF). Warning: testing is not comprehensive.
          Severity: Minor
          Found in AppPkg/Applications/Python/Python-2.7.2/Lib/pdb.py - About 25 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 do_args has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def do_args(self, arg):
                  co = self.curframe.f_code
                  dict = self.curframe_locals
                  n = co.co_argcount
                  if co.co_flags & 4: n = n+1
          Severity: Minor
          Found in AppPkg/Applications/Python/Python-2.7.2/Lib/pdb.py - About 25 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 do_condition has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def do_condition(self, arg):
                  # arg is breakpoint number and condition
                  args = arg.split(' ', 1)
                  try:
                      bpnum = int(args[0].strip())
          Severity: Minor
          Found in AppPkg/Applications/Python/Python-2.7.2/Lib/pdb.py - About 25 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 find_function has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def find_function(funcname, filename):
              cre = re.compile(r'def\s+%s\s*[(]' % re.escape(funcname))
              try:
                  fp = open(filename)
              except IOError:
          Severity: Minor
          Found in AppPkg/Applications/Python/Python-2.7.2/Lib/pdb.py - About 25 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 do_alias has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def do_alias(self, arg):
                  args = arg.split()
                  if len(args) == 0:
                      keys = self.aliases.keys()
                      keys.sort()
          Severity: Minor
          Found in AppPkg/Applications/Python/Python-2.7.2/Lib/pdb.py - About 25 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

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

          Severity: Major
          Found in AppPkg/Applications/Python/Python-2.7.2/Lib/pdb.py and 1 other location - About 2 mos to fix
          vector-uefi/fd/efi/StdLib/lib/python.27/pdb.py on lines 0..1338

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 7475.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          There are no issues that match your filters.

          Category
          Status