avocado-framework/avocado

View on GitHub
selftests/unit/utils/test_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()
Severity: Minor
Found in selftests/unit/utils/test_cpu.py - About 3 hrs to fix

    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/test_cpu.py and 1 other location - About 5 hrs to fix
    selftests/unit/utils/test_cpu.py on lines 176..184

    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_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/test_cpu.py and 1 other location - About 5 hrs to fix
    selftests/unit/utils/test_cpu.py on lines 166..174

    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_s390x_get_version(self):
            with unittest.mock.patch('avocado.utils.cpu.platform.machine',
                                     return_value='s390x'):
                with unittest.mock.patch(
                        'builtins.open',
    Severity: Major
    Found in selftests/unit/utils/test_cpu.py and 5 other locations - About 2 hrs to fix
    selftests/unit/utils/test_cpu.py on lines 115..120
    selftests/unit/utils/test_cpu.py on lines 122..127
    selftests/unit/utils/test_cpu.py on lines 129..134
    selftests/unit/utils/test_cpu.py on lines 153..158
    selftests/unit/utils/test_cpu.py on lines 160..164

    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('builtins.open',
                                         return_value=self._get_data_mock('x86_64')):
    Severity: Major
    Found in selftests/unit/utils/test_cpu.py and 5 other locations - About 2 hrs to fix
    selftests/unit/utils/test_cpu.py on lines 107..113
    selftests/unit/utils/test_cpu.py on lines 122..127
    selftests/unit/utils/test_cpu.py on lines 129..134
    selftests/unit/utils/test_cpu.py on lines 153..158
    selftests/unit/utils/test_cpu.py on lines 160..164

    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/test_cpu.py and 5 other locations - About 2 hrs to fix
    selftests/unit/utils/test_cpu.py on lines 107..113
    selftests/unit/utils/test_cpu.py on lines 115..120
    selftests/unit/utils/test_cpu.py on lines 122..127
    selftests/unit/utils/test_cpu.py on lines 129..134
    selftests/unit/utils/test_cpu.py on lines 160..164

    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('builtins.open',
                                         return_value=self._get_data_mock('power9')):
    Severity: Major
    Found in selftests/unit/utils/test_cpu.py and 5 other locations - About 2 hrs to fix
    selftests/unit/utils/test_cpu.py on lines 107..113
    selftests/unit/utils/test_cpu.py on lines 115..120
    selftests/unit/utils/test_cpu.py on lines 122..127
    selftests/unit/utils/test_cpu.py on lines 153..158
    selftests/unit/utils/test_cpu.py on lines 160..164

    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')):
                    self.assertEqual(cpu.get_family(), "power9")
    Severity: Major
    Found in selftests/unit/utils/test_cpu.py and 5 other locations - About 2 hrs to fix
    selftests/unit/utils/test_cpu.py on lines 107..113
    selftests/unit/utils/test_cpu.py on lines 115..120
    selftests/unit/utils/test_cpu.py on lines 122..127
    selftests/unit/utils/test_cpu.py on lines 129..134
    selftests/unit/utils/test_cpu.py on lines 153..158

    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_version(self):
            with unittest.mock.patch('avocado.utils.cpu.platform.machine',
                                     return_value='powerpc'):
                with unittest.mock.patch('builtins.open',
                                         return_value=self._get_data_mock('power8')):
    Severity: Major
    Found in selftests/unit/utils/test_cpu.py and 5 other locations - About 2 hrs to fix
    selftests/unit/utils/test_cpu.py on lines 107..113
    selftests/unit/utils/test_cpu.py on lines 115..120
    selftests/unit/utils/test_cpu.py on lines 129..134
    selftests/unit/utils/test_cpu.py on lines 153..158
    selftests/unit/utils/test_cpu.py on lines 160..164

    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_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/test_cpu.py and 10 other locations - About 1 hr to fix
    selftests/unit/utils/test_cpu.py on lines 47..50
    selftests/unit/utils/test_cpu.py on lines 61..64
    selftests/unit/utils/test_cpu.py on lines 66..69
    selftests/unit/utils/test_cpu.py on lines 71..75
    selftests/unit/utils/test_cpu.py on lines 77..80
    selftests/unit/utils/test_cpu.py on lines 82..85
    selftests/unit/utils/test_cpu.py on lines 87..90
    selftests/unit/utils/test_cpu.py on lines 92..95
    selftests/unit/utils/test_cpu.py on lines 97..100
    selftests/unit/utils/test_cpu.py on lines 102..105

    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/test_cpu.py and 10 other locations - About 1 hr to fix
    selftests/unit/utils/test_cpu.py on lines 42..45
    selftests/unit/utils/test_cpu.py on lines 47..50
    selftests/unit/utils/test_cpu.py on lines 61..64
    selftests/unit/utils/test_cpu.py on lines 66..69
    selftests/unit/utils/test_cpu.py on lines 71..75
    selftests/unit/utils/test_cpu.py on lines 77..80
    selftests/unit/utils/test_cpu.py on lines 82..85
    selftests/unit/utils/test_cpu.py on lines 92..95
    selftests/unit/utils/test_cpu.py on lines 97..100
    selftests/unit/utils/test_cpu.py on lines 102..105

    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/test_cpu.py and 10 other locations - About 1 hr to fix
    selftests/unit/utils/test_cpu.py on lines 42..45
    selftests/unit/utils/test_cpu.py on lines 47..50
    selftests/unit/utils/test_cpu.py on lines 66..69
    selftests/unit/utils/test_cpu.py on lines 71..75
    selftests/unit/utils/test_cpu.py on lines 77..80
    selftests/unit/utils/test_cpu.py on lines 82..85
    selftests/unit/utils/test_cpu.py on lines 87..90
    selftests/unit/utils/test_cpu.py on lines 92..95
    selftests/unit/utils/test_cpu.py on lines 97..100
    selftests/unit/utils/test_cpu.py on lines 102..105

    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/test_cpu.py and 10 other locations - About 1 hr to fix
    selftests/unit/utils/test_cpu.py on lines 42..45
    selftests/unit/utils/test_cpu.py on lines 47..50
    selftests/unit/utils/test_cpu.py on lines 61..64
    selftests/unit/utils/test_cpu.py on lines 66..69
    selftests/unit/utils/test_cpu.py on lines 71..75
    selftests/unit/utils/test_cpu.py on lines 77..80
    selftests/unit/utils/test_cpu.py on lines 82..85
    selftests/unit/utils/test_cpu.py on lines 87..90
    selftests/unit/utils/test_cpu.py on lines 97..100
    selftests/unit/utils/test_cpu.py on lines 102..105

    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/test_cpu.py and 10 other locations - About 1 hr to fix
    selftests/unit/utils/test_cpu.py on lines 42..45
    selftests/unit/utils/test_cpu.py on lines 47..50
    selftests/unit/utils/test_cpu.py on lines 61..64
    selftests/unit/utils/test_cpu.py on lines 71..75
    selftests/unit/utils/test_cpu.py on lines 77..80
    selftests/unit/utils/test_cpu.py on lines 82..85
    selftests/unit/utils/test_cpu.py on lines 87..90
    selftests/unit/utils/test_cpu.py on lines 92..95
    selftests/unit/utils/test_cpu.py on lines 97..100
    selftests/unit/utils/test_cpu.py on lines 102..105

    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/test_cpu.py and 10 other locations - About 1 hr to fix
    selftests/unit/utils/test_cpu.py on lines 42..45
    selftests/unit/utils/test_cpu.py on lines 47..50
    selftests/unit/utils/test_cpu.py on lines 61..64
    selftests/unit/utils/test_cpu.py on lines 66..69
    selftests/unit/utils/test_cpu.py on lines 77..80
    selftests/unit/utils/test_cpu.py on lines 82..85
    selftests/unit/utils/test_cpu.py on lines 87..90
    selftests/unit/utils/test_cpu.py on lines 92..95
    selftests/unit/utils/test_cpu.py on lines 97..100
    selftests/unit/utils/test_cpu.py on lines 102..105

    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/test_cpu.py and 10 other locations - About 1 hr to fix
    selftests/unit/utils/test_cpu.py on lines 42..45
    selftests/unit/utils/test_cpu.py on lines 47..50
    selftests/unit/utils/test_cpu.py on lines 61..64
    selftests/unit/utils/test_cpu.py on lines 66..69
    selftests/unit/utils/test_cpu.py on lines 71..75
    selftests/unit/utils/test_cpu.py on lines 77..80
    selftests/unit/utils/test_cpu.py on lines 87..90
    selftests/unit/utils/test_cpu.py on lines 92..95
    selftests/unit/utils/test_cpu.py on lines 97..100
    selftests/unit/utils/test_cpu.py on lines 102..105

    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/test_cpu.py and 10 other locations - About 1 hr to fix
    selftests/unit/utils/test_cpu.py on lines 42..45
    selftests/unit/utils/test_cpu.py on lines 61..64
    selftests/unit/utils/test_cpu.py on lines 66..69
    selftests/unit/utils/test_cpu.py on lines 71..75
    selftests/unit/utils/test_cpu.py on lines 77..80
    selftests/unit/utils/test_cpu.py on lines 82..85
    selftests/unit/utils/test_cpu.py on lines 87..90
    selftests/unit/utils/test_cpu.py on lines 92..95
    selftests/unit/utils/test_cpu.py on lines 97..100
    selftests/unit/utils/test_cpu.py on lines 102..105

    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/test_cpu.py and 10 other locations - About 1 hr to fix
    selftests/unit/utils/test_cpu.py on lines 42..45
    selftests/unit/utils/test_cpu.py on lines 47..50
    selftests/unit/utils/test_cpu.py on lines 61..64
    selftests/unit/utils/test_cpu.py on lines 66..69
    selftests/unit/utils/test_cpu.py on lines 71..75
    selftests/unit/utils/test_cpu.py on lines 82..85
    selftests/unit/utils/test_cpu.py on lines 87..90
    selftests/unit/utils/test_cpu.py on lines 92..95
    selftests/unit/utils/test_cpu.py on lines 97..100
    selftests/unit/utils/test_cpu.py on lines 102..105

    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/test_cpu.py and 10 other locations - About 1 hr to fix
    selftests/unit/utils/test_cpu.py on lines 42..45
    selftests/unit/utils/test_cpu.py on lines 47..50
    selftests/unit/utils/test_cpu.py on lines 61..64
    selftests/unit/utils/test_cpu.py on lines 66..69
    selftests/unit/utils/test_cpu.py on lines 71..75
    selftests/unit/utils/test_cpu.py on lines 77..80
    selftests/unit/utils/test_cpu.py on lines 82..85
    selftests/unit/utils/test_cpu.py on lines 87..90
    selftests/unit/utils/test_cpu.py on lines 92..95
    selftests/unit/utils/test_cpu.py on lines 97..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 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/test_cpu.py and 10 other locations - About 1 hr to fix
    selftests/unit/utils/test_cpu.py on lines 42..45
    selftests/unit/utils/test_cpu.py on lines 47..50
    selftests/unit/utils/test_cpu.py on lines 61..64
    selftests/unit/utils/test_cpu.py on lines 66..69
    selftests/unit/utils/test_cpu.py on lines 71..75
    selftests/unit/utils/test_cpu.py on lines 77..80
    selftests/unit/utils/test_cpu.py on lines 82..85
    selftests/unit/utils/test_cpu.py on lines 87..90
    selftests/unit/utils/test_cpu.py on lines 92..95
    selftests/unit/utils/test_cpu.py on lines 102..105

    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 3 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')):
                    self.assertEqual(len(cpu.online_list()), 8)
    Severity: Major
    Found in selftests/unit/utils/test_cpu.py and 2 other locations - About 1 hr to fix
    selftests/unit/utils/test_cpu.py on lines 26..29
    selftests/unit/utils/test_cpu.py on lines 30..33

    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 3 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/test_cpu.py and 2 other locations - About 1 hr to fix
    selftests/unit/utils/test_cpu.py on lines 26..29
    selftests/unit/utils/test_cpu.py on lines 36..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 3 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/test_cpu.py and 2 other locations - About 1 hr to fix
    selftests/unit/utils/test_cpu.py on lines 30..33
    selftests/unit/utils/test_cpu.py on lines 36..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

    There are no issues that match your filters.

    Category
    Status