avocado-framework/avocado

View on GitHub
avocado/core/suite.py

Summary

Maintainability
C
7 hrs
Test Coverage
A
91%

File suite.py has 293 lines of code (exceeds 250 allowed). Consider refactoring.
Wontfix

# 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: Minor
Found in avocado/core/suite.py - About 3 hrs to fix

    Function _get_test_variants has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        def _get_test_variants(self):
            def add_variant(runnable, variant):
                runnable = deepcopy(runnable)
                runnable.variant = dump_variant(variant)
                runnable_with_variant.append(runnable)
    Severity: Minor
    Found in avocado/core/suite.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

    TestSuite has 21 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class TestSuite:
        def __init__(
            self,
            name,
            config=None,
    Severity: Minor
    Found in avocado/core/suite.py - About 2 hrs to fix

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

          def from_config(cls, config, name=None, job_config=None):
              """Helper method to create a TestSuite from config dicts.
      
              This is different from the TestSuite() initialization because here we
              are assuming that you need some help to build the test suite. Avocado
      Severity: Minor
      Found in avocado/core/suite.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 6 arguments (exceeds 4 allowed). Consider refactoring.
      Wontfix

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

        Function variants has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def variants(self):
                if self._variants is None:
                    variants = Varianter()
                    if not variants.is_parsed():
                        try:
        Severity: Minor
        Found in avocado/core/suite.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 resolutions_to_runnables has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def resolutions_to_runnables(resolutions, config):
            """
            Transforms resolver resolutions into runnables suitable for a suite
        
            A resolver resolution
        Severity: Minor
        Found in avocado/core/suite.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 _get_tags_stats_from_nrunner has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def _get_tags_stats_from_nrunner(self):
                stats = {}
                for runnable in self.tests:
                    if runnable is None:
                        continue
        Severity: Minor
        Found in avocado/core/suite.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