avocado-framework/avocado

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

Summary

Maintainability
F
3 days
Test Coverage

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

    def test_multiple_chunk_size_filtering(self, buddy_mocked):
        chunk_size = '>=2 <=4'
        result = memory.get_buddy_info(chunk_size)
        self.assertEqual(result['2'], 10048)
        self.assertEqual(result['3'], 12819)
Severity: Major
Found in selftests/unit/utils/test_memory.py and 2 other locations - About 4 hrs to fix
selftests/unit/utils/test_memory.py on lines 41..47
selftests/unit/utils/test_memory.py on lines 56..62

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

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

    def test_less_than_equal_chunk_size(self, buddy_mocked):
        chunk_size = '<=2'
        result = memory.get_buddy_info(chunk_size)
        self.assertEqual(result['0'], 6418)
        self.assertEqual(result['1'], 10439)
Severity: Major
Found in selftests/unit/utils/test_memory.py and 2 other locations - About 4 hrs to fix
selftests/unit/utils/test_memory.py on lines 56..62
selftests/unit/utils/test_memory.py on lines 77..83

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

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

    def test_greater_than_equal_chunk_size(self, buddy_mocked):
        chunk_size = '>=3'
        result = memory.get_buddy_info(chunk_size)
        self.assertEqual(result['3'], 12819)
        self.assertEqual(result['4'], 19278)
Severity: Major
Found in selftests/unit/utils/test_memory.py and 2 other locations - About 4 hrs to fix
selftests/unit/utils/test_memory.py on lines 41..47
selftests/unit/utils/test_memory.py on lines 77..83

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

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

    def test_greater_than_chunk_size(self, buddy_mocked):
        chunk_size = '>3'
        result = memory.get_buddy_info(chunk_size)
        self.assertEqual(result['4'], 19278)
        self.assertEqual(result['5'], 10357)
Severity: Major
Found in selftests/unit/utils/test_memory.py and 2 other locations - About 3 hrs to fix
selftests/unit/utils/test_memory.py on lines 34..39
selftests/unit/utils/test_memory.py on lines 64..69

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

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

    def test_multiple_chunk_size(self, buddy_mocked):
        chunk_size = '2 4'
        result = memory.get_buddy_info(chunk_size)
        self.assertEqual(result['2'], 10048)
        self.assertEqual(result['4'], 19278)
Severity: Major
Found in selftests/unit/utils/test_memory.py and 2 other locations - About 3 hrs to fix
selftests/unit/utils/test_memory.py on lines 34..39
selftests/unit/utils/test_memory.py on lines 49..54

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

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

    def test_less_than_chunk_size(self, buddy_mocked):
        chunk_size = '<2'
        result = memory.get_buddy_info(chunk_size)
        self.assertEqual(result['0'], 6418)
        self.assertEqual(result['1'], 10439)
Severity: Major
Found in selftests/unit/utils/test_memory.py and 2 other locations - About 3 hrs to fix
selftests/unit/utils/test_memory.py on lines 49..54
selftests/unit/utils/test_memory.py on lines 64..69

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

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_filtering_zone(self, buddy_mocked):
        chunk_size = '0'
        result = memory.get_buddy_info(chunk_size, zones='DMA32')
        self.assertEqual(result[chunk_size], 987)
        self.assertTrue(buddy_mocked.called)
Severity: Major
Found in selftests/unit/utils/test_memory.py and 1 other location - About 2 hrs to fix
selftests/unit/utils/test_memory.py on lines 91..95

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

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_filtering_node(self, buddy_mocked):
        chunk_size = '0'
        result = memory.get_buddy_info(chunk_size, nodes='1')
        self.assertEqual(result[chunk_size], 5430)
        self.assertTrue(buddy_mocked.called)
Severity: Major
Found in selftests/unit/utils/test_memory.py and 1 other location - About 2 hrs to fix
selftests/unit/utils/test_memory.py on lines 97..101

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

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