avocado-framework/avocado

View on GitHub
selftests/unit/utils/cpu.py

Summary

Maintainability
F
6 days
Test Coverage

Cpu has 30 functions (exceeds 20 allowed). Consider refactoring.
Open

class Cpu(Test):
    @staticmethod
    def _get_file_mock(content):
        file_mock = unittest.mock.Mock()
        file_mock.__enter__ = unittest.mock.Mock(return_value=io.BytesIO(content))
Severity: Minor
Found in selftests/unit/utils/cpu.py - About 3 hrs to fix

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

        def test_get_idle_state_on(self):
            retval = {0: {0: True}}
            with unittest.mock.patch("avocado.utils.cpu.online_list", return_value=[0]):
                with unittest.mock.patch(
                    "glob.glob",
    Severity: Major
    Found in selftests/unit/utils/cpu.py and 1 other location - About 5 hrs to fix
    selftests/unit/utils/cpu.py on lines 197..207

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

    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_get_idle_state_off(self):
            retval = {0: {0: False}}
            with unittest.mock.patch("avocado.utils.cpu.online_list", return_value=[0]):
                with unittest.mock.patch(
                    "glob.glob",
    Severity: Major
    Found in selftests/unit/utils/cpu.py and 1 other location - About 5 hrs to fix
    selftests/unit/utils/cpu.py on lines 209..219

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

    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 6 locations. Consider refactoring.
    Open

        def test_power8_get_version(self):
            with unittest.mock.patch(
                "avocado.utils.cpu.platform.machine", return_value="powerpc"
            ):
                with unittest.mock.patch(
    Severity: Major
    Found in selftests/unit/utils/cpu.py and 5 other locations - About 2 hrs to fix
    selftests/unit/utils/cpu.py on lines 130..137
    selftests/unit/utils/cpu.py on lines 139..146
    selftests/unit/utils/cpu.py on lines 157..164
    selftests/unit/utils/cpu.py on lines 183..188
    selftests/unit/utils/cpu.py on lines 190..195

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

    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 6 locations. Consider refactoring.
    Open

        def test_power9_get_version(self):
            with unittest.mock.patch(
                "avocado.utils.cpu.platform.machine", return_value="powerpc"
            ):
                with unittest.mock.patch(
    Severity: Major
    Found in selftests/unit/utils/cpu.py and 5 other locations - About 2 hrs to fix
    selftests/unit/utils/cpu.py on lines 130..137
    selftests/unit/utils/cpu.py on lines 139..146
    selftests/unit/utils/cpu.py on lines 148..155
    selftests/unit/utils/cpu.py on lines 183..188
    selftests/unit/utils/cpu.py on lines 190..195

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

    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 6 locations. Consider refactoring.
    Open

        def test_s390x_get_version(self):
            with unittest.mock.patch(
                "avocado.utils.cpu.platform.machine", return_value="s390x"
            ):
                with unittest.mock.patch(
    Severity: Major
    Found in selftests/unit/utils/cpu.py and 5 other locations - About 2 hrs to fix
    selftests/unit/utils/cpu.py on lines 139..146
    selftests/unit/utils/cpu.py on lines 148..155
    selftests/unit/utils/cpu.py on lines 157..164
    selftests/unit/utils/cpu.py on lines 183..188
    selftests/unit/utils/cpu.py on lines 190..195

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

    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 6 locations. Consider refactoring.
    Open

        def test_intel_get_version(self):
            with unittest.mock.patch(
                "avocado.utils.cpu.platform.machine", return_value="x86_64"
            ):
                with unittest.mock.patch(
    Severity: Major
    Found in selftests/unit/utils/cpu.py and 5 other locations - About 2 hrs to fix
    selftests/unit/utils/cpu.py on lines 130..137
    selftests/unit/utils/cpu.py on lines 148..155
    selftests/unit/utils/cpu.py on lines 157..164
    selftests/unit/utils/cpu.py on lines 183..188
    selftests/unit/utils/cpu.py on lines 190..195

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

    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 6 locations. Consider refactoring.
    Open

        def test_power8_get_family(self):
            with unittest.mock.patch("avocado.utils.cpu.get_arch", return_value="powerpc"):
                with unittest.mock.patch(
                    "builtins.open", return_value=self._get_data_mock("power8")
                ):
    Severity: Major
    Found in selftests/unit/utils/cpu.py and 5 other locations - About 2 hrs to fix
    selftests/unit/utils/cpu.py on lines 130..137
    selftests/unit/utils/cpu.py on lines 139..146
    selftests/unit/utils/cpu.py on lines 148..155
    selftests/unit/utils/cpu.py on lines 157..164
    selftests/unit/utils/cpu.py on lines 190..195

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

    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 6 locations. Consider refactoring.
    Open

        def test_power9_get_family(self):
            with unittest.mock.patch("avocado.utils.cpu.get_arch", return_value="powerpc"):
                with unittest.mock.patch(
                    "builtins.open", return_value=self._get_data_mock("power9")
                ):
    Severity: Major
    Found in selftests/unit/utils/cpu.py and 5 other locations - About 2 hrs to fix
    selftests/unit/utils/cpu.py on lines 130..137
    selftests/unit/utils/cpu.py on lines 139..146
    selftests/unit/utils/cpu.py on lines 148..155
    selftests/unit/utils/cpu.py on lines 157..164
    selftests/unit/utils/cpu.py on lines 183..188

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

    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_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_arch_x86_64(self):
            with unittest.mock.patch(
                "builtins.open", return_value=self._get_data_mock("x86_64")
            ):
                self.assertEqual(cpu.get_arch(), "x86_64")
    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 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_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_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_power8(self):
            with unittest.mock.patch(
                "builtins.open", return_value=self._get_data_mock("power8")
            ):
                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 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_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 11 locations. Consider refactoring.
    Open

        def test_cpu_arch_s390(self):
            with unittest.mock.patch(
                "builtins.open", return_value=self._get_data_mock("s390x")
            ):
                self.assertEqual(cpu.get_arch(), "s390")
    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 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_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 5 locations. Consider refactoring.
    Open

                with unittest.mock.patch(
                    "builtins.open", return_value=self._get_data_mock("s390x_2")
                ):
                    self.assertEqual(len(cpu.online_list()), 4)
    Severity: Major
    Found in selftests/unit/utils/cpu.py and 4 other locations - About 1 hr to fix
    selftests/unit/utils/cpu.py on lines 25..28
    selftests/unit/utils/cpu.py on lines 33..36
    selftests/unit/utils/cpu.py on lines 37..40
    selftests/unit/utils/cpu.py on lines 43..49

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

    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 5 locations. Consider refactoring.
    Open

                with unittest.mock.patch(
                    "builtins.open", return_value=self._get_data_mock("s390x")
                ):
                    self.assertEqual(len(cpu.online_list()), 2)
    Severity: Major
    Found in selftests/unit/utils/cpu.py and 4 other locations - About 1 hr to fix
    selftests/unit/utils/cpu.py on lines 29..32
    selftests/unit/utils/cpu.py on lines 33..36
    selftests/unit/utils/cpu.py on lines 37..40
    selftests/unit/utils/cpu.py on lines 43..49

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

    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 5 locations. Consider refactoring.
    Open

                with unittest.mock.patch(
                    "builtins.open", return_value=self._get_data_mock("s390x_4")
                ):
                    self.assertEqual(len(cpu.online_list()), 16)
    Severity: Major
    Found in selftests/unit/utils/cpu.py and 4 other locations - About 1 hr to fix
    selftests/unit/utils/cpu.py on lines 25..28
    selftests/unit/utils/cpu.py on lines 29..32
    selftests/unit/utils/cpu.py on lines 33..36
    selftests/unit/utils/cpu.py on lines 43..49

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

    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 5 locations. Consider refactoring.
    Open

            with unittest.mock.patch(
                "avocado.utils.cpu.platform.machine", return_value="x86_64"
            ):
                with unittest.mock.patch(
                    "builtins.open", return_value=self._get_data_mock("x86_64")
    Severity: Major
    Found in selftests/unit/utils/cpu.py and 4 other locations - About 1 hr to fix
    selftests/unit/utils/cpu.py on lines 25..28
    selftests/unit/utils/cpu.py on lines 29..32
    selftests/unit/utils/cpu.py on lines 33..36
    selftests/unit/utils/cpu.py on lines 37..40

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

    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 5 locations. Consider refactoring.
    Open

                with unittest.mock.patch(
                    "builtins.open", return_value=self._get_data_mock("s390x_3")
                ):
                    self.assertEqual(len(cpu.online_list()), 6)
    Severity: Major
    Found in selftests/unit/utils/cpu.py and 4 other locations - About 1 hr to fix
    selftests/unit/utils/cpu.py on lines 25..28
    selftests/unit/utils/cpu.py on lines 29..32
    selftests/unit/utils/cpu.py on lines 37..40
    selftests/unit/utils/cpu.py on lines 43..49

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

    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

    There are no issues that match your filters.

    Category
    Status