saltstack/salt

View on GitHub
salt/cloud/clouds/oneandone.py

Summary

Maintainability
F
6 days
Test Coverage

File oneandone.py has 812 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
1&1 Cloud Server Module
=======================

Severity: Major
Found in salt/cloud/clouds/oneandone.py - About 1 day to fix

    Function create has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def create(vm_):
        '''
        Create a single VM from a data dict
        '''
        try:
    Severity: Minor
    Found in salt/cloud/clouds/oneandone.py - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function _get_firewall_policy has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Wontfix

    def _get_firewall_policy(kwargs):
        '''
        Construct FirewallPolicy and FirewallPolicy instances from passed arguments
        '''
        fp_name = kwargs.get('name', None)
    Severity: Minor
    Found in salt/cloud/clouds/oneandone.py - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function list_nodes has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def list_nodes(conn=None, call=None):
        '''
        Return a list of VMs that are on the provider
        '''
        if call == 'action':
    Severity: Minor
    Found in salt/cloud/clouds/oneandone.py - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function _wait_for_completion has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def _wait_for_completion(conn, wait_timeout, server_id):
        '''
        Poll request status until resource is provisioned.
        '''
        wait_timeout = time.time() + wait_timeout
    Severity: Minor
    Found in salt/cloud/clouds/oneandone.py - About 25 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

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

        try:
            data = salt.utils.cloud.wait_for_ip(
                __query_node_data,
                update_args=(vm_, data),
                timeout=config.get_cloud_config_value(
    Severity: Major
    Found in salt/cloud/clouds/oneandone.py and 1 other location - About 6 hrs to fix
    salt/cloud/clouds/profitbricks.py on lines 921..937

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

    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

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

    def get_key_filename(vm_):
        '''
        Check SSH private key file and return absolute path if exists.
        '''
        key_filename = config.get_cloud_config_value(
    Severity: Major
    Found in salt/cloud/clouds/oneandone.py and 1 other location - About 4 hrs to fix
    salt/cloud/clouds/profitbricks.py on lines 781..797

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

    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 show_instance(name, call=None):
        '''
        Show the details from the provider concerning an instance
        '''
        if call != 'action':
    Severity: Major
    Found in salt/cloud/clouds/oneandone.py and 5 other locations - About 2 hrs to fix
    salt/cloud/clouds/profitbricks.py on lines 661..676
    salt/cloud/clouds/proxmox.py on lines 1045..1056
    salt/cloud/clouds/softlayer.py on lines 586..597
    salt/cloud/clouds/softlayer_hw.py on lines 488..499
    salt/cloud/libcloudfuncs.py on lines 505..516

    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 create_ssh_key(kwargs=None, call=None):
        '''
        Create an ssh key
        '''
        if call == 'action':
    Severity: Major
    Found in salt/cloud/clouds/oneandone.py and 1 other location - About 2 hrs to fix
    salt/cloud/clouds/oneandone.py on lines 266..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 2 locations. Consider refactoring.
    Open

    def create_block_storage(kwargs=None, call=None):
        '''
        Create a block storage
        '''
        if call == 'action':
    Severity: Major
    Found in salt/cloud/clouds/oneandone.py and 1 other location - About 2 hrs to fix
    salt/cloud/clouds/oneandone.py on lines 330..347

    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

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

    def list_nodes_select(conn=None, call=None):
        '''
        Return a list of the VMs that are on the provider, with select fields
        '''
        if not conn:
    Severity: Major
    Found in salt/cloud/clouds/oneandone.py and 2 other locations - About 2 hrs to fix
    salt/cloud/clouds/msazure.py on lines 381..389
    salt/cloud/libcloudfuncs.py on lines 493..501

    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

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

        for key, value in six.iteritems(images):
            if vm_image and vm_image in (images[key]['id'], images[key]['name']):
                return images[key]
    Severity: Major
    Found in salt/cloud/clouds/oneandone.py and 1 other location - About 2 hrs to fix
    salt/cloud/clouds/profitbricks.py on lines 515..517

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

    def script(vm_):
        '''
        Return the script deployment object
        '''
        return salt.utils.cloud.os_script(
    Severity: Major
    Found in salt/cloud/clouds/oneandone.py and 4 other locations - About 1 hr to fix
    salt/cloud/clouds/ec2.py on lines 968..977
    salt/cloud/clouds/msazure.py on lines 139..148
    salt/cloud/clouds/parallels.py on lines 435..444
    salt/cloud/clouds/scaleway.py on lines 379..387

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

        try:
            # Check for required profile parameters before sending any API calls.
            if (vm_['profile'] and
               config.is_profile_configured(__opts__,
                                            (__active_provider_name__ or
    Severity: Major
    Found in salt/cloud/clouds/oneandone.py and 5 other locations - About 1 hr to fix
    salt/cloud/clouds/dimensiondata.py on lines 197..204
    salt/cloud/clouds/libvirt.py on lines 297..303
    salt/cloud/clouds/opennebula.py on lines 997..1003
    salt/cloud/clouds/profitbricks.py on lines 821..829
    salt/cloud/clouds/virtualbox.py on lines 144..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 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 2 locations. Consider refactoring.
    Open

    def stop(name, call=None):
        '''
        stop a server by name
        :param name: name given to the machine
        :param call: call value in this case is 'action'
    Severity: Major
    Found in salt/cloud/clouds/oneandone.py and 1 other location - About 1 hr to fix
    salt/cloud/clouds/oneandone.py on lines 970..989

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

    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 start(name, call=None):
        '''
        start a server by name
        :param name: name given to the machine
        :param call: call value in this case is 'action'
    Severity: Major
    Found in salt/cloud/clouds/oneandone.py and 1 other location - About 1 hr to fix
    salt/cloud/clouds/oneandone.py on lines 949..967

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

    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 baremetal_models(call=None):
        '''
        Return a dict of all available baremetal models with relevant data.
        '''
        if call == 'action':
    Severity: Major
    Found in salt/cloud/clouds/oneandone.py and 1 other location - About 1 hr to fix
    salt/cloud/clouds/oneandone.py on lines 450..465

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

    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 avail_sizes(call=None):
        '''
        Return a dict of all available VM sizes on the cloud provider with
        relevant data.
        '''
    Severity: Major
    Found in salt/cloud/clouds/oneandone.py and 1 other location - About 1 hr to fix
    salt/cloud/clouds/oneandone.py on lines 468..482

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

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

        if __opts__.get('update_cachedir', False) is True:
            __utils__['cloud.delete_minion_cachedir'](
                name,
                __active_provider_name__.split(':')[0],
                __opts__
    Severity: Major
    Found in salt/cloud/clouds/oneandone.py and 22 other locations - About 50 mins to fix
    salt/cloud/clouds/azurearm.py on lines 1528..1532
    salt/cloud/clouds/digitalocean.py on lines 868..869
    salt/cloud/clouds/ec2.py on lines 3417..3418
    salt/cloud/clouds/gce.py on lines 2377..2378
    salt/cloud/clouds/gogrid.py on lines 421..422
    salt/cloud/clouds/joyent.py on lines 429..430
    salt/cloud/clouds/linode.py on lines 758..759
    salt/cloud/clouds/lxc.py on lines 415..416
    salt/cloud/clouds/msazure.py on lines 947..948
    salt/cloud/clouds/nova.py on lines 569..570
    salt/cloud/clouds/opennebula.py on lines 1226..1230
    salt/cloud/clouds/openstack.py on lines 816..817
    salt/cloud/clouds/parallels.py on lines 561..562
    salt/cloud/clouds/profitbricks.py on lines 1023..1027
    salt/cloud/clouds/proxmox.py on lines 1194..1196
    salt/cloud/clouds/scaleway.py on lines 456..458
    salt/cloud/clouds/softlayer.py on lines 637..638
    salt/cloud/clouds/softlayer_hw.py on lines 547..548
    salt/cloud/clouds/vagrant.py on lines 308..310
    salt/cloud/clouds/vmware.py on lines 2513..2514
    salt/cloud/clouds/xen.py on lines 1046..1050
    salt/cloud/libcloudfuncs.py on lines 403..404

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

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

    def __virtual__():
        '''
        Check for 1&1 configurations.
        '''
        if get_configured_provider() is False:
    Severity: Major
    Found in salt/cloud/clouds/oneandone.py and 14 other locations - About 30 mins to fix
    salt/cloud/clouds/aliyun.py on lines 90..100
    salt/cloud/clouds/cloudstack.py on lines 78..88
    salt/cloud/clouds/digitalocean.py on lines 68..78
    salt/cloud/clouds/ec2.py on lines 186..196
    salt/cloud/clouds/msazure.py on lines 79..89
    salt/cloud/clouds/opennebula.py on lines 98..108
    salt/cloud/clouds/openstack.py on lines 248..256
    salt/cloud/clouds/profitbricks.py on lines 138..148
    salt/cloud/clouds/proxmox.py on lines 70..80
    salt/cloud/clouds/pyrax.py on lines 29..39
    salt/cloud/clouds/qingcloud.py on lines 71..81
    salt/cloud/clouds/softlayer.py on lines 55..65
    salt/cloud/clouds/softlayer_hw.py on lines 53..63
    salt/cloud/clouds/vmware.py on lines 173..183

    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