hackedteam/vector-edk

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

Summary

Maintainability
F
2 mos
Test Coverage

File __init__.py has 1330 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2001-2010 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
Severity: Major
Found in vector-uefi/fd/efi/StdLib/lib/python.27/logging/__init__.py - About 3 days to fix

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

        def __init__(self, name, level, pathname, lineno,
                     msg, args, exc_info, func=None):
            """
            Initialize a logging record with interesting information.
            """
    Severity: Minor
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/logging/__init__.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 emit has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def emit(self, record):
            """
            Emit a record.
    
            If a formatter is specified, it is used to format the record.
    Severity: Minor
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/logging/__init__.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 shutdown has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def shutdown(handlerList=_handlerList):
        """
        Perform any cleanup actions in the logging system (e.g. flushing
        buffers).
    
    Severity: Minor
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/logging/__init__.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 callHandlers has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def callHandlers(self, record):
            """
            Pass a record to all relevant handlers.
    
            Loop through all handlers for this logger and its parents in the
    Severity: Minor
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/logging/__init__.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 makeRecord has 9 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def makeRecord(self, name, level, fn, lno, msg, args, exc_info, func=None, extra=None):
    Severity: Major
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/logging/__init__.py - About 1 hr to fix

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

          def _fixupParents(self, alogger):
              """
              Ensure that there are either loggers or placeholders all the way
              from the specified logger to the root of the logger hierarchy.
              """
      Severity: Minor
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/logging/__init__.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 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(self, name, level, pathname, lineno,
      Severity: Major
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/logging/__init__.py - About 1 hr to fix

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

            def format(self, record):
                """
                Format the specified record as text.
        
                The record's attribute dictionary is used as the operand to a
        Severity: Minor
        Found in vector-uefi/fd/efi/StdLib/lib/python.27/logging/__init__.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 _showwarning has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def _showwarning(message, category, filename, lineno, file=None, line=None):
        Severity: Minor
        Found in vector-uefi/fd/efi/StdLib/lib/python.27/logging/__init__.py - About 45 mins to fix

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

              def getMessage(self):
                  """
                  Return the message for this LogRecord.
          
                  Return the message for this LogRecord after merging any user-supplied
          Severity: Minor
          Found in vector-uefi/fd/efi/StdLib/lib/python.27/logging/__init__.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 _log has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def _log(self, level, msg, args, exc_info=None, extra=None):
          Severity: Minor
          Found in vector-uefi/fd/efi/StdLib/lib/python.27/logging/__init__.py - About 35 mins to fix

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

                def _log(self, level, msg, args, exc_info=None, extra=None):
                    """
                    Low-level logging routine which creates a LogRecord and then calls
                    all the handlers of this logger to handle the record.
                    """
            Severity: Minor
            Found in vector-uefi/fd/efi/StdLib/lib/python.27/logging/__init__.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 makeRecord has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def makeRecord(self, name, level, fn, lno, msg, args, exc_info, func=None, extra=None):
                    """
                    A factory method which can be overridden in subclasses to create
                    specialized LogRecords.
                    """
            Severity: Minor
            Found in vector-uefi/fd/efi/StdLib/lib/python.27/logging/__init__.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 getLogger has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def getLogger(self, name):
                    """
                    Get a logger with the specified name (channel name), creating it
                    if it doesn't yet exist. This name is a dot-separated hierarchical
                    name, such as "a", "a.b", "a.b.c" or similar.
            Severity: Minor
            Found in vector-uefi/fd/efi/StdLib/lib/python.27/logging/__init__.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 captureWarnings has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def captureWarnings(capture):
                """
                If capture is true, redirect all warnings to the logging package.
                If capture is False, ensure that warnings are not redirected to logging
                but to their original destinations.
            Severity: Minor
            Found in vector-uefi/fd/efi/StdLib/lib/python.27/logging/__init__.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 _showwarning has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def _showwarning(message, category, filename, lineno, file=None, line=None):
                """
                Implementation of showwarnings which redirects to logging, which will first
                check to see if the file parameter is None. If a file is specified, it will
                delegate to the original warnings implementation of showwarning. Otherwise,
            Severity: Minor
            Found in vector-uefi/fd/efi/StdLib/lib/python.27/logging/__init__.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 basicConfig has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def basicConfig(**kwargs):
                """
                Do basic configuration for the logging system.
            
                This function does nothing if the root logger already has handlers
            Severity: Minor
            Found in vector-uefi/fd/efi/StdLib/lib/python.27/logging/__init__.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/logging/__init__.py and 1 other location - About 2 mos to fix
            AppPkg/Applications/Python/Python-2.7.2/Lib/logging/__init__.py on lines 0..1707

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

            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