avocado-framework/avocado

View on GitHub

Showing 885 of 903 total issues

Similar blocks of code found in 11 locations. Consider refactoring.
Open

    def test_cpu_arch_power9(self):
        with unittest.mock.patch(
            "builtins.open", return_value=self._get_data_mock("power9")
        ):
            self.assertEqual(cpu.get_arch(), "powerpc")
Severity: Major
Found in selftests/unit/utils/cpu.py and 10 other locations - About 1 hr to fix
selftests/unit/utils/cpu.py on lines 51..55
selftests/unit/utils/cpu.py on lines 57..61
selftests/unit/utils/cpu.py on lines 76..80
selftests/unit/utils/cpu.py on lines 88..92
selftests/unit/utils/cpu.py on lines 94..98
selftests/unit/utils/cpu.py on lines 100..104
selftests/unit/utils/cpu.py on lines 106..110
selftests/unit/utils/cpu.py on lines 112..116
selftests/unit/utils/cpu.py on lines 118..122
selftests/unit/utils/cpu.py on lines 124..128

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

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

Similar blocks of code found in 11 locations. Consider refactoring.
Open

    def test_cpu_arch_risc_v(self):
        with unittest.mock.patch(
            "builtins.open", return_value=self._get_data_mock("risc_v")
        ):
            self.assertEqual(cpu.get_arch(), "riscv")
Severity: Major
Found in selftests/unit/utils/cpu.py and 10 other locations - About 1 hr to fix
selftests/unit/utils/cpu.py on lines 51..55
selftests/unit/utils/cpu.py on lines 57..61
selftests/unit/utils/cpu.py on lines 76..80
selftests/unit/utils/cpu.py on lines 82..86
selftests/unit/utils/cpu.py on lines 88..92
selftests/unit/utils/cpu.py on lines 94..98
selftests/unit/utils/cpu.py on lines 100..104
selftests/unit/utils/cpu.py on lines 112..116
selftests/unit/utils/cpu.py on lines 118..122
selftests/unit/utils/cpu.py on lines 124..128

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

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

Similar blocks of code found in 11 locations. Consider refactoring.
Open

    def test_cpu_vendor_power9(self):
        with unittest.mock.patch(
            "builtins.open", return_value=self._get_data_mock("power9")
        ):
            self.assertEqual(cpu.get_vendor(), "ibm")
Severity: Major
Found in selftests/unit/utils/cpu.py and 10 other locations - About 1 hr to fix
selftests/unit/utils/cpu.py on lines 51..55
selftests/unit/utils/cpu.py on lines 57..61
selftests/unit/utils/cpu.py on lines 76..80
selftests/unit/utils/cpu.py on lines 82..86
selftests/unit/utils/cpu.py on lines 88..92
selftests/unit/utils/cpu.py on lines 94..98
selftests/unit/utils/cpu.py on lines 100..104
selftests/unit/utils/cpu.py on lines 106..110
selftests/unit/utils/cpu.py on lines 112..116
selftests/unit/utils/cpu.py on lines 118..122

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

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

Similar blocks of code found in 11 locations. Consider refactoring.
Open

    def test_cpu_arch_i386(self):
        with unittest.mock.patch(
            "builtins.open", return_value=self._get_data_mock("i386")
        ):
            self.assertEqual(cpu.get_arch(), "i386")
Severity: Major
Found in selftests/unit/utils/cpu.py and 10 other locations - About 1 hr to fix
selftests/unit/utils/cpu.py on lines 57..61
selftests/unit/utils/cpu.py on lines 76..80
selftests/unit/utils/cpu.py on lines 82..86
selftests/unit/utils/cpu.py on lines 88..92
selftests/unit/utils/cpu.py on lines 94..98
selftests/unit/utils/cpu.py on lines 100..104
selftests/unit/utils/cpu.py on lines 106..110
selftests/unit/utils/cpu.py on lines 112..116
selftests/unit/utils/cpu.py on lines 118..122
selftests/unit/utils/cpu.py on lines 124..128

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

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

Similar blocks of code found in 11 locations. Consider refactoring.
Open

    def test_cpu_arch_arm_v8(self):
        with unittest.mock.patch(
            "builtins.open", return_value=self._get_data_mock("armv8")
        ):
            self.assertEqual(cpu.get_arch(), "aarch64")
Severity: Major
Found in selftests/unit/utils/cpu.py and 10 other locations - About 1 hr to fix
selftests/unit/utils/cpu.py on lines 51..55
selftests/unit/utils/cpu.py on lines 57..61
selftests/unit/utils/cpu.py on lines 76..80
selftests/unit/utils/cpu.py on lines 82..86
selftests/unit/utils/cpu.py on lines 88..92
selftests/unit/utils/cpu.py on lines 94..98
selftests/unit/utils/cpu.py on lines 106..110
selftests/unit/utils/cpu.py on lines 112..116
selftests/unit/utils/cpu.py on lines 118..122
selftests/unit/utils/cpu.py on lines 124..128

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

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

Similar blocks of code found in 11 locations. Consider refactoring.
Open

    def test_cpu_vendor_intel(self):
        with unittest.mock.patch(
            "builtins.open", return_value=self._get_data_mock("x86_64")
        ):
            self.assertEqual(cpu.get_vendor(), "intel")
Severity: Major
Found in selftests/unit/utils/cpu.py and 10 other locations - About 1 hr to fix
selftests/unit/utils/cpu.py on lines 51..55
selftests/unit/utils/cpu.py on lines 57..61
selftests/unit/utils/cpu.py on lines 76..80
selftests/unit/utils/cpu.py on lines 82..86
selftests/unit/utils/cpu.py on lines 88..92
selftests/unit/utils/cpu.py on lines 94..98
selftests/unit/utils/cpu.py on lines 100..104
selftests/unit/utils/cpu.py on lines 106..110
selftests/unit/utils/cpu.py on lines 118..122
selftests/unit/utils/cpu.py on lines 124..128

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

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

Similar blocks of code found in 11 locations. Consider refactoring.
Open

    def test_cpu_arch_arm_v7(self):
        with unittest.mock.patch(
            "builtins.open", return_value=self._get_data_mock("armv7")
        ):
            self.assertEqual(cpu.get_arch(), "arm")
Severity: Major
Found in selftests/unit/utils/cpu.py and 10 other locations - About 1 hr to fix
selftests/unit/utils/cpu.py on lines 51..55
selftests/unit/utils/cpu.py on lines 57..61
selftests/unit/utils/cpu.py on lines 76..80
selftests/unit/utils/cpu.py on lines 82..86
selftests/unit/utils/cpu.py on lines 88..92
selftests/unit/utils/cpu.py on lines 100..104
selftests/unit/utils/cpu.py on lines 106..110
selftests/unit/utils/cpu.py on lines 112..116
selftests/unit/utils/cpu.py on lines 118..122
selftests/unit/utils/cpu.py on lines 124..128

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

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

Similar blocks of code found in 11 locations. Consider refactoring.
Open

    def test_cpu_arch_power8(self):
        with unittest.mock.patch(
            "builtins.open", return_value=self._get_data_mock("power8")
        ):
            self.assertEqual(cpu.get_arch(), "powerpc")
Severity: Major
Found in selftests/unit/utils/cpu.py and 10 other locations - About 1 hr to fix
selftests/unit/utils/cpu.py on lines 51..55
selftests/unit/utils/cpu.py on lines 57..61
selftests/unit/utils/cpu.py on lines 82..86
selftests/unit/utils/cpu.py on lines 88..92
selftests/unit/utils/cpu.py on lines 94..98
selftests/unit/utils/cpu.py on lines 100..104
selftests/unit/utils/cpu.py on lines 106..110
selftests/unit/utils/cpu.py on lines 112..116
selftests/unit/utils/cpu.py on lines 118..122
selftests/unit/utils/cpu.py on lines 124..128

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

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

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

    def test_values(self):
        self.assertEqual(data_structures.DataSize("10m").b, 10485760)
        self.assertEqual(data_structures.DataSize("10M").b, 10485760)
Severity: Major
Found in selftests/unit/utils/data_structures.py and 1 other location - About 1 hr to fix
selftests/unit/utils/data_structures.py on lines 138..140

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

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

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

    def test_check_name_for_file_contains_fail(self):
        class MyProbe(distro.Probe):
            CHECK_FILE = "/etc/issue"
            CHECK_FILE_CONTAINS = "text"

Severity: Major
Found in selftests/unit/utils/distro.py and 1 other location - About 1 hr to fix
selftests/unit/utils/distro.py on lines 15..21

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

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

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

    def test_value_and_type(self):
        self.assertEqual(data_structures.DataSize("0b").b, 0)
        self.assertEqual(data_structures.DataSize("0t").b, 0)
Severity: Major
Found in selftests/unit/utils/data_structures.py and 1 other location - About 1 hr to fix
selftests/unit/utils/data_structures.py on lines 142..144

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

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

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

    def test_check_name_for_file(self):
        class MyProbe(distro.Probe):
            CHECK_FILE = "/etc/issue"
            CHECK_FILE_DISTRO_NAME = "superdistro"

Severity: Major
Found in selftests/unit/utils/distro.py and 1 other location - About 1 hr to fix
selftests/unit/utils/distro.py on lines 23..29

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

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

Function configure has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def configure(self, parser):
        """
        Add the subparser for the run action.

        :param parser: Main test runner parser.
Severity: Minor
Found in avocado/plugins/run.py - About 1 hr to fix

    Function test_get_job_results_dir has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def test_get_job_results_dir(self):
            from avocado.core import data_dir, job_id
    
            # First let's mock a jobs results directory
            #
    Severity: Minor
    Found in selftests/unit/datadir.py - About 1 hr to fix

      Function _create_from_yaml has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def _create_from_yaml(path):
          """Create tree structure from yaml stream"""
      
          # Parse file name ([$using:]$path)
          path = __RE_FILE_SPLIT.split(path, 1)

      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 render has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def render(self, result, job):
              if job.status in ("RUNNING", "ERROR", "FAIL"):
                  return  # Don't create results on unfinished or errored jobs
              if not (
                  job.config.get("job.run.result.html.enabled")
      Severity: Minor
      Found in optional_plugins/html/avocado_result_html/__init__.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 cover_missing_combination has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def cover_missing_combination(self, matrix):
              """
              Randomly finds one missing combination. This combination puts into each
              row of the matrix. The row with the best coverage is the solution
      
      
      Severity: Minor
      Found in optional_plugins/varianter_cit/avocado_varianter_cit/Cit.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 _node_content_from_dict has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def _node_content_from_dict(path, node, values, using):
          """Processes dict values into the current node content"""
          for key, value in values.items():
              if isinstance(key, mux.Control):
                  if key.code == YAML_USING:

      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_relative_dir has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def _get_relative_dir(self):
              """
              When an asset name is not an URI, and:
                1. it also has a hash;
                2. or it has multiple locations;
      Severity: Minor
      Found in avocado/utils/asset.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 graft has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def graft(self, dict_):
              for name, value in list(dict_.items()):
                  name = name.replace("-", "_")
                  if isinstance(value, dict):
                      value = GdbDynamicObject(value)
      Severity: Minor
      Found in avocado/utils/external/gdbmi_parser.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

      Severity
      Category
      Status
      Source
      Language