hackedteam/vector-edk

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

Summary

Maintainability
F
4 mos
Test Coverage

File doctest.py has 1934 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Module doctest.
# Released to the public domain 16-Jan-2001, by Tim Peters (tim@python.org).
# Major enhancements and refactoring by:
#     Jim Fulton
#     Edward Loper
Severity: Major
Found in AppPkg/Applications/Python/Python-2.7.2/Lib/doctest.py - About 5 days to fix

    Function __run has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
    Open

        def __run(self, test, compileflags, out):
            """
            Run the examples in `test`.  Write the outcome of each example
            with one of the `DocTestRunner.report_*` methods, using the
            writer function `out`.  `compileflags` is the set of compiler
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/doctest.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 _find has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
    Open

        def _find(self, tests, obj, name, module, source_lines, globs, seen):
            """
            Find tests for the given object and any contained objects, and
            add them to `tests`.
            """
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/doctest.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 summarize has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        def summarize(self, verbose=None):
            """
            Print a summary of all the test cases that have been run by
            this DocTestRunner, and return a tuple `(f, t)`, where `f` is
            the total number of failed examples, and `t` is the total
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/doctest.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 _find_lineno has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

        def _find_lineno(self, obj, source_lines):
            """
            Return a line number of the given object's docstring.  Note:
            this method assumes that the object has a docstring.
            """
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/doctest.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 find has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def find(self, obj, name=None, module=None, globs=None, extraglobs=None):
            """
            Return a list of the DocTests that are defined by the given
            object's docstring, or by any of its contained objects'
            docstrings.
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/doctest.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 check_output has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def check_output(self, want, got, optionflags):
            """
            Return True iff the actual output from an example (`got`)
            matches the expected output (`want`).  These strings are
            always considered to match if they are identical; but
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/doctest.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 _get_test has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def _get_test(self, obj, name, module, globs, source_lines):
            """
            Return a DocTest for the given object, if it defines a docstring;
            otherwise, return None.
            """
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/doctest.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 _ellipsis_match has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def _ellipsis_match(want, got):
        """
        Essentially the only subtle case:
        >>> _ellipsis_match('aa...aa', 'aaa')
        False
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/doctest.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 testfile has 12 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def testfile(filename, module_relative=True, name=None, package=None,
    Severity: Major
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/doctest.py - About 1 hr to fix

      Function DocTestSuite has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      def DocTestSuite(module=None, globs=None, extraglobs=None, test_finder=None,
                       **options):
          """
          Convert doctest tests for a module to a unittest test suite.
      
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/doctest.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 output_difference has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def output_difference(self, example, got, optionflags):
              """
              Return a string describing the differences between the
              expected output for a given example (`example`) and the actual
              output (`got`).  `optionflags` is the set of option flags used
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/doctest.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 testfile has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      def testfile(filename, module_relative=True, name=None, package=None,
                   globs=None, verbose=None, report=True, optionflags=0,
                   extraglobs=None, raise_on_error=False, parser=DocTestParser(),
                   encoding=None):
          """
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/doctest.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 testmod has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def testmod(m=None, name=None, globs=None, verbose=None,
      Severity: Major
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/doctest.py - About 1 hr to fix

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

        def testmod(m=None, name=None, globs=None, verbose=None,
                    report=True, optionflags=0, extraglobs=None,
                    raise_on_error=False, exclude_empty=False):
            """m=None, name=None, globs=None, verbose=None, report=True,
               optionflags=0, extraglobs=None, raise_on_error=False,
        Severity: Minor
        Found in AppPkg/Applications/Python/Python-2.7.2/Lib/doctest.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 script_from_examples has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        def script_from_examples(s):
            r"""Extract script from text with examples.
        
               Converts text with examples to a Python script.  Example input is
               converted to regular code.  Example output and all other words
        Severity: Minor
        Found in AppPkg/Applications/Python/Python-2.7.2/Lib/doctest.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 _test has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        def _test():
            testfiles = [arg for arg in sys.argv[1:] if arg and arg[0] != '-']
            if not testfiles:
                name = os.path.basename(sys.argv[0])
                if '__loader__' in globals():          # python -m
        Severity: Minor
        Found in AppPkg/Applications/Python/Python-2.7.2/Lib/doctest.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 _find_options has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def _find_options(self, source, name, lineno):
                """
                Return a dictionary containing option overrides extracted from
                option directives in the given source string.
        
        Severity: Minor
        Found in AppPkg/Applications/Python/Python-2.7.2/Lib/doctest.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 DocFileTest has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def DocFileTest(path, module_relative=True, package=None,
        Severity: Major
        Found in AppPkg/Applications/Python/Python-2.7.2/Lib/doctest.py - About 50 mins to fix

          Function _find has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def _find(self, tests, obj, name, module, source_lines, globs, seen):
          Severity: Major
          Found in AppPkg/Applications/Python/Python-2.7.2/Lib/doctest.py - About 50 mins to fix

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

                def __init__(self, examples, globs, name, filename, lineno, docstring):
            Severity: Minor
            Found in AppPkg/Applications/Python/Python-2.7.2/Lib/doctest.py - About 45 mins to fix

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

              def _module_relative_path(module, path):
                  if not inspect.ismodule(module):
                      raise TypeError, 'Expected a module: %r' % module
                  if path.startswith('/'):
                      raise ValueError, 'Module-relative files may not have absolute paths'
              Severity: Minor
              Found in AppPkg/Applications/Python/Python-2.7.2/Lib/doctest.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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def __init__(self, source, want, exc_msg=None, lineno=0, indent=0,
              Severity: Minor
              Found in AppPkg/Applications/Python/Python-2.7.2/Lib/doctest.py - About 45 mins to fix

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

                def run_docstring_examples(f, globs, verbose=False, name="NoName",
                Severity: Minor
                Found in AppPkg/Applications/Python/Python-2.7.2/Lib/doctest.py - About 45 mins to fix

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

                      def __init__(self, test, optionflags=0, setUp=None, tearDown=None,
                  Severity: Minor
                  Found in AppPkg/Applications/Python/Python-2.7.2/Lib/doctest.py - About 35 mins to fix

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

                    def DocTestSuite(module=None, globs=None, extraglobs=None, test_finder=None,
                    Severity: Minor
                    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/doctest.py - About 35 mins to fix

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

                          def _get_test(self, obj, name, module, globs, source_lines):
                      Severity: Minor
                      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/doctest.py - About 35 mins to fix

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

                            def get_doctest(self, string, globs, name, filename, lineno):
                        Severity: Minor
                        Found in AppPkg/Applications/Python/Python-2.7.2/Lib/doctest.py - About 35 mins to fix

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

                              def find(self, obj, name=None, module=None, globs=None, extraglobs=None):
                          Severity: Minor
                          Found in AppPkg/Applications/Python/Python-2.7.2/Lib/doctest.py - About 35 mins to fix

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

                                def _from_module(self, module, object):
                                    """
                                    Return true if the given object is defined in the given
                                    module.
                                    """
                            Severity: Minor
                            Found in AppPkg/Applications/Python/Python-2.7.2/Lib/doctest.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 True
                            Severity: Major
                            Found in AppPkg/Applications/Python/Python-2.7.2/Lib/doctest.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

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

                                Avoid too many return statements within this function.
                                Open

                                            return module.__name__ == object.__module__
                                Severity: Major
                                Found in AppPkg/Applications/Python/Python-2.7.2/Lib/doctest.py - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

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

                                    Avoid too many return statements within this function.
                                    Open

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

                                      Avoid too many return statements within this function.
                                      Open

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

                                        Avoid too many return statements within this function.
                                        Open

                                                    return True # [XX] no way not be sure.
                                        Severity: Major
                                        Found in AppPkg/Applications/Python/Python-2.7.2/Lib/doctest.py - About 30 mins to fix

                                          Avoid too many return statements within this function.
                                          Open

                                                      return 'Expected nothing\nGot nothing\n'
                                          Severity: Major
                                          Found in AppPkg/Applications/Python/Python-2.7.2/Lib/doctest.py - About 30 mins to fix

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

                                            def debug_script(src, pm=False, globs=None):
                                                "Debug a test script.  `src` is the script, as a string."
                                                import pdb
                                            
                                                # Note that tempfile.NameTemporaryFile() cannot be used.  As the
                                            Severity: Minor
                                            Found in AppPkg/Applications/Python/Python-2.7.2/Lib/doctest.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 _load_testfile has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                            def _load_testfile(filename, package, module_relative):
                                                if module_relative:
                                                    package = _normalize_module(package, 3)
                                                    filename = _module_relative_path(package, filename)
                                                    if hasattr(package, '__loader__'):
                                            Severity: Minor
                                            Found in AppPkg/Applications/Python/Python-2.7.2/Lib/doctest.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 _failure_header has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                                def _failure_header(self, test, example):
                                                    out = [self.DIVIDER]
                                                    if test.filename:
                                                        if test.lineno is not None and example.lineno is not None:
                                                            lineno = test.lineno + example.lineno + 1
                                            Severity: Minor
                                            Found in AppPkg/Applications/Python/Python-2.7.2/Lib/doctest.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 DocFileTest has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                            def DocFileTest(path, module_relative=True, package=None,
                                                            globs=None, parser=DocTestParser(),
                                                            encoding=None, **options):
                                                if globs is None:
                                                    globs = {}
                                            Severity: Minor
                                            Found in AppPkg/Applications/Python/Python-2.7.2/Lib/doctest.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/doctest.py and 1 other location - About 3 mos to fix
                                            vector-uefi/fd/efi/StdLib/lib/python.27/doctest.py on lines 0..2731

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

                                            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