avocado-framework/avocado

View on GitHub
avocado/core/sysinfo.py

Summary

Maintainability
B
4 hrs
Test Coverage
D
65%

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

    def _get_collectibles(self, c_profiler):
        self.sysinfo_files = gather_collectibles_config(self.config)

        profiler = c_profiler
        if profiler is None:
Severity: Minor
Found in avocado/core/sysinfo.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 _set_collectibles has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def _set_collectibles(self):
        timeout = self.config.get("sysinfo.collect.commands_timeout")
        locale = self.config.get("sysinfo.collect.locale")
        if self.profiler:
            for cmd in self.sysinfo_files["profilers"]:
Severity: Minor
Found in avocado/core/sysinfo.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 start has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def start(self):
        """Log all collectibles at the start of the event."""
        os.environ["AVOCADO_SYSINFODIR"] = self.pre_dir
        for log_hook in self.start_collectibles:
            # log daemons in profile directory
Severity: Minor
Found in avocado/core/sysinfo.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 end has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def end(self, status=""):
        """
        Logging hook called whenever a job finishes.
        """
        optimized = self.config.get("sysinfo.collect.optimize")
Severity: Minor
Found in avocado/core/sysinfo.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 _get_syslog_watcher has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _get_syslog_watcher():
        logpaths = ["/var/log/messages", "/var/log/syslog", "/var/log/system.log"]
        for logpath in logpaths:
            if os.path.exists(logpath):
                try:
Severity: Minor
Found in avocado/core/sysinfo.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 gather_collectibles_config has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def gather_collectibles_config(config):
    sysinfo_files = {}

    for collectible in ["commands", "files", "fail_commands", "fail_files"]:
        tmp_file = config.get(f"sysinfo.collectibles.{collectible}")
Severity: Minor
Found in avocado/core/sysinfo.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