avocado-framework/avocado

View on GitHub
avocado/core/task/runtime.py

Summary

Maintainability
C
1 day
Test Coverage
B
85%

File runtime.py has 321 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import itertools
import os
from enum import Enum

from avocado.core.dispatcher import TestPostDispatcher, TestPreDispatcher
Severity: Minor
Found in avocado/core/task/runtime.py - About 3 hrs to fix

    Function get_tasks_from_test_task has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def get_tasks_from_test_task(
    Severity: Major
    Found in avocado/core/task/runtime.py - About 1 hr to fix

      Function from_runnable has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def from_runnable(
      Severity: Major
      Found in avocado/core/task/runtime.py - About 1 hr to fix

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

            def get_tasks_from_test_task(
                cls,
                test_task,
                no_digits,
                base_dir,
        Severity: Minor
        Found in avocado/core/task/runtime.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 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(
        Severity: Major
        Found in avocado/core/task/runtime.py - About 50 mins to fix

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

              def get_tasks_in_topological_order(self):
                  """Computes the topological order of runtime tasks in graph
          
                  :returns: runtime tasks in topological order
                  :rtype: list
          Severity: Minor
          Found in avocado/core/task/runtime.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 __init__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def __init__(
                  self,
                  tests,
                  test_suite_name,
                  status_server_uri,
          Severity: Minor
          Found in avocado/core/task/runtime.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

          There are no issues that match your filters.

          Category
          Status