hackedteam/vector-edk

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

Summary

Maintainability
F
1 mo
Test Coverage

File trace.py has 624 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python

# portions copyright 2001, Autonomous Zones Industries, Inc., all rights...
# err...  reserved and offered to the public under the terms of the
# Python 2.2 license.
Severity: Major
Found in vector-uefi/fd/efi/StdLib/lib/python.27/trace.py - About 1 day to fix

    Function main has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
    Open

    def main(argv=None):
        import getopt
    
        if argv is None:
            argv = sys.argv
    Severity: Minor
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/trace.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 write_results has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

        def write_results(self, show_missing=True, summary=False, coverdir=None):
            """
            @param coverdir
            """
            if self.calledfuncs:
    Severity: Minor
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/trace.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 globaltrace_lt has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        def globaltrace_lt(self, frame, why, arg):
            """Handler for call events.
    
            If the code block being entered is to be ignored, returns `None',
            else returns self.localtrace.
    Severity: Minor
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/trace.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 file_module_function_of has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        def file_module_function_of(self, frame):
            code = frame.f_code
            filename = code.co_filename
            if filename:
                modulename = modname(filename)
    Severity: Minor
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/trace.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 names has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def names(self, filename, modulename):
            if modulename in self._ignore:
                return self._ignore[modulename]
    
            # haven't seen this one before, so see if the module name is
    Severity: Minor
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/trace.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 write_results_file has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def write_results_file(self, path, lines, lnotab, lines_hit):
            """Return a coverage results file in path."""
    
            try:
                outfile = open(path, "w")
    Severity: Minor
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/trace.py - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

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

        def __init__(self, count=1, trace=1, countfuncs=0, countcallers=0,
    Severity: Major
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/trace.py - About 1 hr to fix

      Function find_strings has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def find_strings(filename):
          """Return a dict of possible docstring positions.
      
          The dict maps line numbers to strings.  There is an entry for
          line that contains only a string or a part of a triple-quoted
      Severity: Minor
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/trace.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 fullmodname has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def fullmodname(path):
          """Return a plausible module name for the path."""
      
          # If the file 'path' is part of a package, then the filename isn't
          # enough to uniquely identify it.  Try to do the right thing by
      Severity: Minor
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/trace.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 __init__ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def __init__(self, count=1, trace=1, countfuncs=0, countcallers=0,
                       ignoremods=(), ignoredirs=(), infile=None, outfile=None,
                       timing=False):
              """
              @param count true iff it should count number of times each
      Severity: Minor
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/trace.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 self.trace:
                                  print (" --- modulename: %s, funcname: %s"
                                         % (modulename, code.co_name))
                              return self.localtrace
      Severity: Major
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/trace.py - About 45 mins to fix

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

            def __init__(self, counts=None, calledfuncs=None, infile=None,
        Severity: Minor
        Found in vector-uefi/fd/efi/StdLib/lib/python.27/trace.py - About 35 mins to fix

          Avoid too many return statements within this function.
          Open

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

            Avoid too many return statements within this function.
            Open

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

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

                  def __init__(self, counts=None, calledfuncs=None, infile=None,
                               callers=None, outfile=None):
                      self.counts = counts
                      if self.counts is None:
                          self.counts = {}
              Severity: Minor
              Found in vector-uefi/fd/efi/StdLib/lib/python.27/trace.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/trace.py and 1 other location - About 1 mo to fix
              AppPkg/Applications/Python/Python-2.7.2/Lib/trace.py on lines 0..827

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

              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