avocado-framework/avocado

View on GitHub

Showing 685 of 703 total issues

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

    def test_runner_python_unittest_empty_uri_error(self):
        runnable = Runnable("python-unittest", "")
        runner_klass = runnable.pick_runner_class()
        runner = runner_klass()
        results = [status for status in runner.run(runnable)]
Severity: Major
Found in selftests/unit/runner.py and 1 other location - About 7 hrs to fix
selftests/unit/runner.py on lines 143..152

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

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_runner_python_unittest_error(self):
        runnable = Runnable("python-unittest", "error")
        runner_klass = runnable.pick_runner_class()
        runner = runner_klass()
        results = [status for status in runner.run(runnable)]
Severity: Major
Found in selftests/unit/runner.py and 1 other location - About 7 hrs to fix
selftests/unit/runner.py on lines 154..163

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

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

File pci.py has 472 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: Minor
Found in avocado/utils/pci.py - About 7 hrs to fix

    File assets.py has 470 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: Minor
    Found in avocado/plugins/assets.py - About 7 hrs to fix

      File vmimage.py has 463 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import unittest.mock
      from urllib.error import HTTPError
      
      from avocado.utils import vmimage
      from selftests.utils import setup_avocado_loggers
      Severity: Minor
      Found in selftests/unit/utils/vmimage.py - About 7 hrs to fix

        Function run has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
        Open

            def run(self, config):
                def _get_name(test):
                    return str(test["id"])
        
                def _get_name_no_id(test):
        Severity: Minor
        Found in avocado/plugins/diff.py - About 7 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

        File tree.py has 459 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: Minor
        Found in avocado/core/tree.py - About 7 hrs to fix

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

          class FailTest(Test):
              def setUp(self):
                  self.log.info("setup pre")
                  self.log.info("setup post")
          
          
          Severity: Major
          Found in selftests/.data/test_statuses.py and 1 other location - About 6 hrs to fix
          selftests/.data/test_statuses.py on lines 71..84

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

          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

          class FailTeardown(Test):
              def setUp(self):
                  self.log.info("setup pre")
                  self.log.info("setup post")
          
          
          Severity: Major
          Found in selftests/.data/test_statuses.py and 1 other location - About 6 hrs to fix
          selftests/.data/test_statuses.py on lines 87..100

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

          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

          class CancelSetup(Test):
              def setUp(self):
                  self.log.info("setup pre")
                  self.cancel()
                  self.log.info("setup post")
          Severity: Major
          Found in selftests/.data/test_statuses.py and 1 other location - About 6 hrs to fix
          selftests/.data/test_statuses.py on lines 103..116

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

          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

          class FailSetup(Test):
              def setUp(self):
                  self.log.info("setup pre")
                  self.fail()
                  self.log.info("setup post")
          Severity: Major
          Found in selftests/.data/test_statuses.py and 1 other location - About 6 hrs to fix
          selftests/.data/test_statuses.py on lines 55..68

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

          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

          class CancelTest(Test):
              def setUp(self):
                  self.log.info("setup pre")
                  self.log.info("setup post")
          
          
          Severity: Major
          Found in selftests/.data/test_statuses.py and 1 other location - About 6 hrs to fix
          selftests/.data/test_statuses.py on lines 119..132

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

          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

          class CancelTeardown(Test):
              def setUp(self):
                  self.log.info("setup pre")
                  self.log.info("setup post")
          
          
          Severity: Major
          Found in selftests/.data/test_statuses.py and 1 other location - About 6 hrs to fix
          selftests/.data/test_statuses.py on lines 135..148

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

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

          def vg_ramdisk_cleanup(
              ramdisk_filename=None,
              vg_ramdisk_dir=None,
              vg_name=None,
              loop_device=None,
          Severity: Minor
          Found in avocado/utils/lv_utils.py - About 6 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

          File pmem.py has 439 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: Minor
          Found in avocado/utils/pmem.py - About 6 hrs to fix

            File podman.py has 437 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import asyncio
            import json
            import logging
            import os
            import re
            Severity: Minor
            Found in avocado/plugins/spawners/podman.py - About 6 hrs to fix

              File statemachine.py has 433 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import asyncio
              import collections
              import logging
              import multiprocessing
              import time
              Severity: Minor
              Found in avocado/core/task/statemachine.py - About 6 hrs to fix

                Function parse has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
                Open

                    def parse(file_object):
                        """
                        Parsing of input file with parameters and constraints
                
                        :param file_object: input file for parsing
                Severity: Minor
                Found in optional_plugins/varianter_cit/avocado_varianter_cit/Parser.py - About 6 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 main has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
                Open

                def main():
                    exitcode = exit_codes.UTILITY_OK
                    parser = argparse.ArgumentParser(
                        "install|remove|check-installed|list-all|list-files|add-repo|"
                        "remove-repo|upgrade|what-provides|install-what-provides arguments"
                Severity: Minor
                Found in avocado/utils/software_manager/main.py - About 6 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

                File setup.py has 423 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                #!/bin/env python3
                # 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 setup.py - About 6 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language