hackedteam/vector-edk

View on GitHub
vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py

Summary

Maintainability
F
7 mos
Test Coverage

File pydoc.py has 1979 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python
# -*- coding: latin-1 -*-
"""Generate Python documentation in HTML or text for interactive use.

In the Python interpreter, do "from pydoc import help" to provide online
Severity: Major
Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 5 days to fix

    Function docmodule has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
    Open

        def docmodule(self, object, name=None, mod=None, *ignored):
            """Produce HTML documentation for a module object."""
            name = object.__name__ # ignore the passed-in name
            try:
                all = object.__all__
    Severity: Minor
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 1 day 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 docclass has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
    Open

        def docclass(self, object, name=None, mod=None, funcs={}, classes={},
                     *ignored):
            """Produce HTML documentation for a class object."""
            realname = object.__name__
            name = name or realname
    Severity: Minor
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 7 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 docmodule has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
    Open

        def docmodule(self, object, name=None, mod=None):
            """Produce text documentation for a given module object."""
            name = object.__name__ # ignore the passed-in name
            synop, desc = splitdoc(getdoc(object))
            result = self.section('NAME', name + (synop and ' - ' + synop))
    Severity: Minor
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 7 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 docclass has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
    Open

        def docclass(self, object, name=None, mod=None, *ignored):
            """Produce text documentation for a given class object."""
            realname = object.__name__
            name = name or realname
            bases = object.__bases__
    Severity: Minor
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 6 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 run has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
    Open

        def run(self, callback, key=None, completer=None, onerror=None):
            if key: key = lower(key)
            self.quit = False
            seen = {}
    
    Severity: Minor
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 4 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 gui has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

    def gui():
        """Graphical interface (starts web server and pops up a control window)."""
        class GUI:
            def __init__(self, window, port=7464):
                self.window = window
    Severity: Minor
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 4 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 cli has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

    def cli():
        """Command-line interface (looks at sys.argv to decide what to do)."""
        import getopt
        class BadUsage: pass
    
    Severity: Minor
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 4 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 serve has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

    def serve(port, callback=None, completer=None):
        import BaseHTTPServer, mimetools, select
    
        # Patch up mimetools.Message so it doesn't break if rfc822 is reloaded.
        class Message(mimetools.Message):
    Severity: Minor
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 4 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 docroutine has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

        def docroutine(self, object, name=None, mod=None,
                       funcs={}, classes={}, methods={}, cl=None):
            """Produce HTML documentation for a function or method object."""
            realname = object.__name__
            name = name or realname
    Severity: Minor
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.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 docroutine has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

        def docroutine(self, object, name=None, mod=None, cl=None):
            """Produce text documentation for a function or method object."""
            realname = object.__name__
            name = name or realname
            note = ''
    Severity: Minor
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.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

    HTMLDoc has 22 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class HTMLDoc(Doc):
        """Formatter class for HTML documentation."""
    
        # ------------------------------------------- HTML formatting utilities
    
    Severity: Minor
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 2 hrs to fix

      Function safeimport has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      def safeimport(path, forceload=0, cache={}):
          """Import a module; handle errors; return None if the module isn't found.
      
          If the module *is* found but an exception occurs, it's wrapped in an
          ErrorDuringImport exception and reraised.  Unlike __import__, if a
      Severity: Minor
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.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 getpager has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

      def getpager():
          """Decide what method to use for paging through text."""
          if type(sys.stdout) is not types.FileType:
              return plainpager
          if not sys.stdin.isatty() or not sys.stdout.isatty():
      Severity: Minor
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.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 source_synopsis has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

      def source_synopsis(file):
          line = file.readline()
          while line[:1] == '#' or not strip(line):
              line = file.readline()
              if not line: break
      Severity: Minor
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.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 help has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def help(self, request):
              if type(request) is type(''):
                  request = request.strip()
                  if request == 'help': self.intro()
                  elif request == 'keywords': self.listkeywords()
      Severity: Minor
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.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 describe has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      def describe(thing):
          """Produce a short description of the given thing."""
          if inspect.ismodule(thing):
              if thing.__name__ in sys.builtin_module_names:
                  return 'built-in module ' + thing.__name__
      Severity: Minor
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.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 locate has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      def locate(path, forceload=0):
          """Locate an object by name or dotted path, importing as necessary."""
          parts = [part for part in split(path, '.') if part]
          module, n = None, 0
          while n < len(parts):
      Severity: Minor
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.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 formattree has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def formattree(self, tree, modname, parent=None):
              """Produce HTML for a class tree as given by inspect.getclasstree()."""
              result = ''
              for entry in tree:
                  if type(entry) is type(()):
      Severity: Minor
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.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 docmodule has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def docmodule(self, object, name=None, mod=None, *ignored):
              """Produce HTML documentation for a module object."""
              name = object.__name__ # ignore the passed-in name
              try:
                  all = object.__all__
      Severity: Minor
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 1 hr to fix

        Function synopsis has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        def synopsis(filename, cache={}):
            """Get the one-line summary out of a module file."""
            mtime = os.stat(filename).st_mtime
            lastupdate, result = cache.get(filename, (0, None))
            if lastupdate < mtime:
        Severity: Minor
        Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.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 markup has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def markup(self, text, escape=None, funcs={}, classes={}, methods={}):
                """Mark up some plain text, given a context of symbols to look for.
                Each context dictionary maps object names to anchor names."""
                escape = escape or self.escape
                results = []
        Severity: Minor
        Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.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 ttypager has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        def ttypager(text):
            """Page through text on a text terminal."""
            lines = split(plain(text), '\n')
            try:
                import tty
        Severity: Minor
        Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.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 list has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def list(self, items, columns=4, width=80):
                items = items[:]
                items.sort()
                colw = width / columns
                rows = (len(items) + columns - 1) / columns
        Severity: Minor
        Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.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 docmodule has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def docmodule(self, object, name=None, mod=None):
                """Produce text documentation for a given module object."""
                name = object.__name__ # ignore the passed-in name
                synop, desc = splitdoc(getdoc(object))
                result = self.section('NAME', name + (synop and ' - ' + synop))
        Severity: Minor
        Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 1 hr to fix

          Function section has 8 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def section(self, title, fgcol, bgcol, contents, width=6,
          Severity: Major
          Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 1 hr to fix

            Function docroutine has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def docroutine(self, object, name=None, mod=None,
            Severity: Major
            Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 1 hr to fix

              Function getdocloc has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def getdocloc(self, object):
                      """Return the location of module docs or None"""
              
                      try:
                          file = inspect.getabsfile(object)
              Severity: Minor
              Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.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 listmodules has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def listmodules(self, key=''):
                      if key:
                          self.output.write('''
              Here is a list of matching modules.  Enter any module name to get more help.
              
              Severity: Minor
              Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.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 docother has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def docother(self, object, name=None, mod=None, parent=None, maxlen=None, doc=None):
              Severity: Major
              Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 50 mins to fix

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

                    def docother(self, object, name=None, mod=None, parent=None, maxlen=None, doc=None):
                        """Produce text documentation for a data object."""
                        repr = self.repr(object)
                        if maxlen:
                            line = (name and name + ' = ' or '') + repr
                Severity: Minor
                Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.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 key in cdict:
                                            cdict[key] = cdict[base] = modname + '.html#' + key
                        funcs, fdict = [], {}
                Severity: Major
                Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 45 mins to fix

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

                      def docclass(self, object, name=None, mod=None, funcs={}, classes={},
                  Severity: Minor
                  Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 45 mins to fix

                    Consider simplifying this complex logical expression.
                    Open

                        if type(object) is _OLD_INSTANCE_TYPE:
                            # If the passed object is an instance of an old-style class,
                            # document its available methods instead of its value.
                            object = object.__class__
                        elif not (inspect.ismodule(object) or
                    Severity: Major
                    Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 40 mins to fix

                      Function docdata has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def docdata(self, object, name=None, mod=None, cl=None):
                      Severity: Minor
                      Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 35 mins to fix

                        Function docproperty has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def docproperty(self, object, name=None, mod=None, cl=None):
                        Severity: Minor
                        Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 35 mins to fix

                          Function docdata has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              def docdata(self, object, name=None, mod=None, cl=None):
                          Severity: Minor
                          Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 35 mins to fix

                            Function docproperty has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                def docproperty(self, object, name=None, mod=None, cl=None):
                            Severity: Minor
                            Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 35 mins to fix

                              Function docroutine has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  def docroutine(self, object, name=None, mod=None, cl=None):
                              Severity: Minor
                              Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 35 mins to fix

                                Function markup has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    def markup(self, text, escape=None, funcs={}, classes={}, methods={}):
                                Severity: Minor
                                Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 35 mins to fix

                                  Function docother has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                      def docother(self, object, name=None, mod=None, *ignored):
                                  Severity: Minor
                                  Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 35 mins to fix

                                    Function showtopic has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        def showtopic(self, topic, more_xrefs=''):
                                            try:
                                                import pydoc_data.topics
                                            except ImportError:
                                                self.output.write('''
                                    Severity: Minor
                                    Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.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 interact has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        def interact(self):
                                            self.output.write('\n')
                                            while True:
                                                try:
                                                    request = self.getline('help> ')
                                    Severity: Minor
                                    Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.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 document has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        def document(self, object, name=None, *args):
                                            """Generate documentation for an object."""
                                            args = (object, name) + args
                                            # 'try' clause is to attempt to handle the possibility that inspect
                                            # identifies something in a way that pydoc itself has issues handling;
                                    Severity: Minor
                                    Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.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 formattree has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        def formattree(self, tree, modname, parent=None, prefix=''):
                                            """Render in text a class tree as returned by inspect.getclasstree()."""
                                            result = ''
                                            for entry in tree:
                                                if type(entry) is type(()):
                                    Severity: Minor
                                    Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.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

                                            if isinstance(object, property): return self.docproperty(*args)
                                    Severity: Major
                                    Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                              return 'class ' + thing.__name__
                                      Severity: Major
                                      Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 30 mins to fix

                                        Avoid too many return statements within this function.
                                        Open

                                                    return lambda text: pipepager(plain(text), os.environ['PAGER'])
                                        Severity: Major
                                        Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 30 mins to fix

                                          Avoid too many return statements within this function.
                                          Open

                                                  return plainpager
                                          Severity: Major
                                          Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 30 mins to fix

                                            Avoid too many return statements within this function.
                                            Open

                                                    return not name.startswith('_')
                                            Severity: Major
                                            Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 30 mins to fix

                                              Avoid too many return statements within this function.
                                              Open

                                                          if inspect.isroutine(object): return self.docroutine(*args)
                                              Severity: Major
                                              Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 30 mins to fix

                                                Avoid too many return statements within this function.
                                                Open

                                                        return lambda text: pipepager(text, 'less')
                                                Severity: Major
                                                Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 30 mins to fix

                                                  Avoid too many return statements within this function.
                                                  Open

                                                              return ttypager
                                                  Severity: Major
                                                  Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 30 mins to fix

                                                    Avoid too many return statements within this function.
                                                    Open

                                                                return lambda text: pipepager(text, 'more')
                                                    Severity: Major
                                                    Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 30 mins to fix

                                                      Avoid too many return statements within this function.
                                                      Open

                                                              return 'getset descriptor %s.%s.%s' % (
                                                      Severity: Major
                                                      Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 30 mins to fix

                                                        Avoid too many return statements within this function.
                                                        Open

                                                                return 'method ' + thing.__name__
                                                        Severity: Major
                                                        Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 30 mins to fix

                                                          Avoid too many return statements within this function.
                                                          Open

                                                                  return 'member descriptor %s.%s.%s' % (
                                                          Severity: Major
                                                          Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 30 mins to fix

                                                            Avoid too many return statements within this function.
                                                            Open

                                                                    return self.docother(*args)
                                                            Severity: Major
                                                            Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 30 mins to fix

                                                              Avoid too many return statements within this function.
                                                              Open

                                                                          return lambda text: pipepager(text, os.environ['PAGER'])
                                                              Severity: Major
                                                              Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 30 mins to fix

                                                                Avoid too many return statements within this function.
                                                                Open

                                                                        return lambda text: tempfilepager(plain(text), 'more <')
                                                                Severity: Major
                                                                Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 30 mins to fix

                                                                  Avoid too many return statements within this function.
                                                                  Open

                                                                          return 'instance of ' + thing.__class__.__name__
                                                                  Severity: Major
                                                                  Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 30 mins to fix

                                                                    Avoid too many return statements within this function.
                                                                    Open

                                                                            return plainpager
                                                                    Severity: Major
                                                                    Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 30 mins to fix

                                                                      Avoid too many return statements within this function.
                                                                      Open

                                                                              return 'function ' + thing.__name__
                                                                      Severity: Major
                                                                      Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 30 mins to fix

                                                                        Avoid too many return statements within this function.
                                                                        Open

                                                                            return type(thing).__name__
                                                                        Severity: Major
                                                                        Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py - About 30 mins to fix

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

                                                                              def multicolumn(self, list, format, cols=4):
                                                                                  """Format a list of items into a multi-column list."""
                                                                                  result = ''
                                                                                  rows = (len(list)+cols-1)//cols
                                                                                  for col in range(cols):
                                                                          Severity: Minor
                                                                          Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.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 visiblename has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                          Open

                                                                          def visiblename(name, all=None, obj=None):
                                                                              """Decide whether to show documentation on a variable."""
                                                                              # Certain special names are redundant.
                                                                              _hidden_names = ('__builtins__', '__doc__', '__file__', '__path__',
                                                                                               '__module__', '__name__', '__slots__', '__package__')
                                                                          Severity: Minor
                                                                          Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.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 ispackage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                          Open

                                                                          def ispackage(path):
                                                                              """Guess whether a path refers to a package directory."""
                                                                              if os.path.isdir(path):
                                                                                  for ext in ('.py', '.pyc', '.pyo'):
                                                                                      if os.path.isfile(os.path.join(path, '__init__' + ext)):
                                                                          Severity: Minor
                                                                          Found in vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.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 vector-uefi/fd/efi/StdLib/lib/python.27/pydoc.py and 1 other location - About 6 mos to fix
                                                                          AppPkg/Applications/Python/PyMod-2.7.2/Lib/pydoc.py on lines 0..2341

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

                                                                          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