avocado-framework/avocado

View on GitHub
selftests/unit/test_tags.py

Summary

Maintainability
F
4 days
Test Coverage

File test_tags.py has 264 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import stat
import unittest

from avocado.core import loader, tags
from avocado.core.nrunner import Runnable
Severity: Minor
Found in selftests/unit/test_tags.py - About 2 hrs to fix

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

        def test_filter_fast_net(self):
            filtered = tags.filter_test_tags(self.test_suite, ['fast,net'], False, False)
            self.assertEqual(len(filtered), 2)
            self.assertEqual(filtered[0][0], 'FastTest')
            self.assertEqual(filtered[0][1]['methodName'], 'test_fast')
    Severity: Major
    Found in selftests/unit/test_tags.py and 1 other location - About 1 day to fix
    selftests/unit/test_tags.py on lines 146..152

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 138.

    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_filter_arch_include_empty(self):
            filtered = tags.filter_test_tags(self.test_suite, ['arch'], True, False)
            self.assertEqual(len(filtered), 2)
            self.assertEqual(filtered[0][0], 'SafeX86Test')
            self.assertEqual(filtered[0][1]['methodName'], 'test_safe_x86')
    Severity: Major
    Found in selftests/unit/test_tags.py and 1 other location - About 1 day to fix
    selftests/unit/test_tags.py on lines 122..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 138.

    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_filter_arch(self):
            filtered = tags.filter_test_tags(self.test_suite, ['arch'], False, False)
            self.assertEqual(len(filtered), 1)
            self.assertEqual(filtered[0][0], 'SafeX86Test')
            self.assertEqual(filtered[0][1]['methodName'], 'test_safe_x86')
    Severity: Major
    Found in selftests/unit/test_tags.py and 1 other location - About 5 hrs to fix
    selftests/unit/test_tags.py on lines 154..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 88.

    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_filter_arch_x86_64(self):
            filtered = tags.filter_test_tags(self.test_suite, ['arch:x86_64'], False, False)
            self.assertEqual(len(filtered), 1)
            self.assertEqual(filtered[0][0], 'SafeX86Test')
            self.assertEqual(filtered[0][1]['methodName'], 'test_safe_x86')
    Severity: Major
    Found in selftests/unit/test_tags.py and 1 other location - About 5 hrs to fix
    selftests/unit/test_tags.py on lines 140..144

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 88.

    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

    DEFAULT_NON_EXEC_MODE = (stat.S_IRUSR | stat.S_IWUSR |
                             stat.S_IRGRP | stat.S_IWGRP |
                             stat.S_IROTH)
    Severity: Major
    Found in selftests/unit/test_tags.py and 4 other locations - About 1 hr to fix
    selftests/functional/test_loader.py on lines 136..138
    selftests/functional/test_resolver.py on lines 16..18
    selftests/unit/plugin/test_resolver.py on lines 13..15
    selftests/unit/test_loader.py on lines 14..16

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

    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