avocado-framework/avocado

View on GitHub
avocado/core/output.py

Summary

Maintainability
D
2 days
Test Coverage
B
81%

Starting a process with a shell, possible injection detected, security issue.
Open

        self.pipe = os.popen(paginator, "w")
Severity: Major
Found in avocado/core/output.py by bandit

File output.py has 600 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
Severity: Major
Found in avocado/core/output.py - About 1 day to fix

    Function reconfigure has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

    def reconfigure(args):
        """
        Adjust logging handlers accordingly to app args and re-log messages.
        """
    
    
    Severity: Minor
    Found in avocado/core/output.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 add_log_handler has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def add_log_handler(
    Severity: Minor
    Found in avocado/core/output.py - About 45 mins to fix

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

      def add_log_handler(
          logger,
          klass=logging.StreamHandler,
          stream=sys.stdout,
          level=logging.DEBUG,
      Severity: Minor
      Found in avocado/core/output.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 emit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def emit(self, record):
              try:
                  msg = self.format(record)
                  if record.levelno < logging.INFO:  # Most messages are INFO
                      pass
      Severity: Minor
      Found in avocado/core/output.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 split_loggers_and_levels has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def split_loggers_and_levels(loggers):
          """Separates logger names and legger levels.
      
          :param loggers: Logger names with or without levels
          :type loggers: List of strings in format STREAM[:LEVEL][,STREAM[:LEVEL][,...]]
      Severity: Minor
      Found in avocado/core/output.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 print_records has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def print_records(self):
              """
              Prints all stored messages as they occurred into streams they were
              produced for.
              """
      Severity: Minor
      Found in avocado/core/output.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 __init__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def __init__(self):
              self.HEADER = self.COLOR_BLUE
              self.PASS = self.COLOR_GREEN
              self.SKIP = self.COLOR_YELLOW
              self.FAIL = self.COLOR_RED
      Severity: Minor
      Found in avocado/core/output.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 log_plugin_failures has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def log_plugin_failures(failures):
          """
          Log in the application UI failures to load a set of plugins
      
          :param failures: a list of load failures, usually coming from a
      Severity: Minor
      Found in avocado/core/output.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

      There are no issues that match your filters.

      Category
      Status