cloudcomputinghust/CAL

View on GitHub
calplus/tests/unit/v1/network/drivers/test_amazon_driver.py

Summary

Maintainability
F
3 days
Test Coverage

File test_amazon_driver.py has 393 lines of code (exceeds 250 allowed). Consider refactoring.
Open

""" AmazonDriver for Network
    based on BaseDriver for Network Resource
"""


Severity: Minor
Found in calplus/tests/unit/v1/network/drivers/test_amazon_driver.py - About 5 hrs to fix

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

        def test_show_unable_to_show_network(self):
            self.mock_object(
                self.fake_driver.client, 'describe_subnets',
                mock.Mock(side_effect=ClientError(
                    fake_error_code,
    Severity: Major
    Found in calplus/tests/unit/v1/network/drivers/test_amazon_driver.py and 3 other locations - About 3 hrs to fix
    calplus/tests/unit/v1/compute/drivers/test_amazon_driver.py on lines 239..252
    calplus/tests/unit/v1/compute/drivers/test_amazon_driver.py on lines 413..425
    calplus/tests/unit/v1/compute/drivers/test_amazon_driver.py on lines 437..449

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

    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_release_public_ip_unable_to_release(self):
            self.mock_object(
                self.fake_driver.client, 'release_address',
                mock.Mock(side_effect=ClientError(
                    fake_error_code,
    Severity: Major
    Found in calplus/tests/unit/v1/network/drivers/test_amazon_driver.py and 1 other location - About 3 hrs to fix
    calplus/tests/unit/v1/object_storage/drivers/test_amazon_driver.py on lines 271..283

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

        def test_list_unable_to_list_network(self):
            self.mock_object(
                self.fake_driver.client, 'describe_subnets',
                mock.Mock(side_effect=ClientError(
                    fake_error_code,
    Severity: Major
    Found in calplus/tests/unit/v1/network/drivers/test_amazon_driver.py and 3 other locations - About 2 hrs to fix
    calplus/tests/unit/v1/compute/drivers/test_amazon_driver.py on lines 264..276
    calplus/tests/unit/v1/network/drivers/test_amazon_driver.py on lines 422..435
    calplus/tests/unit/v1/object_storage/drivers/test_amazon_driver.py on lines 248..259

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

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

        def test_list_public_ip_unable_to_list(self):
            self.mock_object(
                self.fake_driver.client, 'describe_addresses',
                mock.Mock(side_effect=ClientError(
                    fake_error_code,
    Severity: Major
    Found in calplus/tests/unit/v1/network/drivers/test_amazon_driver.py and 3 other locations - About 2 hrs to fix
    calplus/tests/unit/v1/compute/drivers/test_amazon_driver.py on lines 264..276
    calplus/tests/unit/v1/network/drivers/test_amazon_driver.py on lines 276..288
    calplus/tests/unit/v1/object_storage/drivers/test_amazon_driver.py on lines 248..259

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

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

        def test_show_successfully(self):
            self.mock_object(
                self.fake_driver.client, 'describe_subnets',
                mock.Mock(return_value=fake_describe_subnets))
            self.fake_driver.show('subnet-9dcb6b38')
    Severity: Major
    Found in calplus/tests/unit/v1/network/drivers/test_amazon_driver.py and 3 other locations - About 2 hrs to fix
    calplus/tests/unit/v1/compute/drivers/test_amazon_driver.py on lines 229..237
    calplus/tests/unit/v1/compute/drivers/test_amazon_driver.py on lines 403..411
    calplus/tests/unit/v1/compute/drivers/test_amazon_driver.py on lines 427..435

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

    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_list_successfully(self):
            self.mock_object(
                self.fake_driver.client, 'describe_subnets',
                mock.Mock(return_value=fake_describe_subnets))
    
    
    Severity: Major
    Found in calplus/tests/unit/v1/network/drivers/test_amazon_driver.py and 5 other locations - About 2 hrs to fix
    calplus/tests/unit/v1/compute/drivers/test_amazon_driver.py on lines 254..261
    calplus/tests/unit/v1/network/drivers/test_amazon_driver.py on lines 412..419
    calplus/tests/unit/v1/network/drivers/test_openstack_driver.py on lines 446..456
    calplus/tests/unit/v1/network/test_client.py on lines 232..239
    calplus/tests/unit/v1/object_storage/drivers/test_amazon_driver.py on lines 239..246

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

    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_list_public_ip_successfully(self):
            self.mock_object(
                self.fake_driver.client, 'describe_addresses',
                mock.Mock(return_value=fake_list_ip_out))
    
    
    Severity: Major
    Found in calplus/tests/unit/v1/network/drivers/test_amazon_driver.py and 5 other locations - About 2 hrs to fix
    calplus/tests/unit/v1/compute/drivers/test_amazon_driver.py on lines 254..261
    calplus/tests/unit/v1/network/drivers/test_amazon_driver.py on lines 266..273
    calplus/tests/unit/v1/network/drivers/test_openstack_driver.py on lines 446..456
    calplus/tests/unit/v1/network/test_client.py on lines 232..239
    calplus/tests/unit/v1/object_storage/drivers/test_amazon_driver.py on lines 239..246

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

    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

    fake_error_code = {
        'ResponseMetadata': {
            'HTTPStatusCode': 400,
            'RequestId': 'req-a4570d1a-8319-4d6f-8077-7044d72ef449',
            'HTTPHeaders': {
    Severity: Minor
    Found in calplus/tests/unit/v1/network/drivers/test_amazon_driver.py and 2 other locations - About 35 mins to fix
    calplus/tests/unit/v1/compute/drivers/test_amazon_driver.py on lines 24..36
    calplus/tests/unit/v1/object_storage/drivers/test_amazon_driver.py on lines 191..203

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

    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