hackedteam/vector-edk

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

Summary

Maintainability
F
2 mos
Test Coverage

File config.py has 719 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/config.py - About 1 day to fix

    Function configure has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
    Open

        def configure(self):
            """Do the configuration."""
    
            config = self.config
            if 'version' not in config:
    Severity: Minor
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/logging/config.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 listen has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
    Open

    def listen(port=DEFAULT_LOGGING_CONFIG_PORT):
        """
        Start up a socket server on the specified port, and listen for new
        configurations.
    
    Severity: Minor
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/logging/config.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 _install_loggers has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

    def _install_loggers(cp, handlers, disable_existing_loggers):
        """Create and install loggers"""
    
        # configure the root first
        llist = cp.get("loggers", "keys")
    Severity: Minor
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/logging/config.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 cfg_convert has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

        def cfg_convert(self, value):
            """Default converter for the cfg:// protocol."""
            rest = value
            m = self.WORD_PATTERN.match(rest)
            if m is None:
    Severity: Minor
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/logging/config.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 _install_handlers has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    def _install_handlers(cp, formatters):
        """Install and return handlers"""
        hlist = cp.get("handlers", "keys")
        if not len(hlist):
            return {}
    Severity: Minor
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/logging/config.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 configure_handler has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        def configure_handler(self, config):
            """Configure a handler from a dictionary."""
            formatter = config.pop('formatter', None)
            if formatter:
                try:
    Severity: Minor
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/logging/config.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 _create_formatters has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def _create_formatters(cp):
        """Create and return formatters"""
        flist = cp.get("formatters", "keys")
        if not len(flist):
            return {}
    Severity: Minor
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/logging/config.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 convert has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def convert(self, value):
            """
            Convert values to an appropriate type. dicts, lists and tuples are
            replaced by their converting alternatives. Strings are checked to
            see if they have a conversion format and are converted if they do.
    Severity: Minor
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/logging/config.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

    Avoid deeply nested control flow statements.
    Open

                            if not self.DIGIT_PATTERN.match(idx):
                                d = d[idx]
                            else:
                                try:
                                    n = int(idx) # try as number first (most likely)
    Severity: Major
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/logging/config.py - About 45 mins to fix

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

          def common_logger_config(self, logger, config, incremental=False):
              """
              Perform configuration which is common to root and non-root loggers.
              """
              level = config.get('level', None)
      Severity: Minor
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/logging/config.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 configure_formatter has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def configure_formatter(self, config):
              """Configure a formatter from a dictionary."""
              if '()' in config:
                  factory = config['()'] # for use in exception handler
                  try:
      Severity: Minor
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/logging/config.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

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

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

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

      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