saltstack/salt

View on GitHub

Showing 7,542 of 17,590 total issues

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

    elif (
        name in dbs and __salt__['postgres.db_alter'](
            name,
            tablespace=tablespace,
            owner=owner, owner_recurse=owner_recurse, **db_args)
Severity: Major
Found in salt/states/postgres_database.py and 1 other location - About 2 hrs to fix
salt/utils/pushover.py on lines 137..142

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

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 _serial_sanitizer(instr):
    '''Replaces the last 1/4 of a string with X's'''
    length = len(instr)
    index = int(math.floor(length * .75))
    return '{0}{1}'.format(instr[:index], 'X' * (length - index))
Severity: Major
Found in salt/modules/grains.py and 1 other location - About 2 hrs to fix
salt/client/ssh/wrapper/grains.py on lines 26..32

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

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

        if ret and ret[name]:
            confile = ret[name]
            ret = local.cmd(name, 'file.remove', [confile])
            if ret and ret[name]:
                log.info('removed minion %s configuration file %s',
Severity: Major
Found in salt/cloud/clouds/saltify.py and 1 other location - About 2 hrs to fix
salt/cloud/clouds/saltify.py on lines 460..467

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

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

    if res['res']:
        ret['res'] = True
        ret['message'] = ('Check {0} added to agent.'.format(kwargs['name']))
    else:
        ret['res'] = False
Severity: Major
Found in salt/modules/consul.py and 1 other location - About 2 hrs to fix
salt/modules/consul.py on lines 587..593

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

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

        salt_argv = [
            'python{0}'.format(sys.version_info[0]),
            os.path.join(thin_dest_path, 'salt-call'),
            '--metadata',
            '--local',
Severity: Major
Found in salt/modules/dockermod.py and 1 other location - About 2 hrs to fix
salt/modules/chroot.py on lines 136..147

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

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

        salt_argv = [
            'python{}'.format(sys.version_info[0]),
            os.path.join(chroot_path, 'salt-call'),
            '--metadata',
            '--local',
Severity: Major
Found in salt/modules/chroot.py and 1 other location - About 2 hrs to fix
salt/modules/dockermod.py on lines 6696..6707

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

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

        if len(fields) > 1:
            slots[fields[0]]['slotname'] = fields[1]
        else:
            slots[fields[0]]['slotname'] = ''
Severity: Major
Found in salt/modules/dracr.py and 1 other location - About 2 hrs to fix
salt/modules/dracr.py on lines 1073..1076

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

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

        if target == 'primary' or target == 'both':
            query = {'type': 'config',
                     'action': 'set',
                     'xpath': '/config/devices/entry[@name=\'localhost.localdomain\']/deviceconfig/system/ntp-servers/'
                              'primary-ntp-server/authentication-type',
Severity: Major
Found in salt/modules/panos.py and 1 other location - About 2 hrs to fix
salt/modules/panos.py on lines 2020..2029

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

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

            if response['retcode'] != 0:
                ret.update({host: {'enable_firewall': {'message': response['stdout'],
                                                       'success': False}}})
            else:
                ret.update({host: {'enable_firewall': {'success': True}}})
Severity: Major
Found in salt/modules/vsphere.py and 1 other location - About 2 hrs to fix
salt/modules/vsphere.py on lines 1074..1078

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

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

    if bool(r):
        need_update = True
        ret['changes'].setdefault('new', {})['actions'] = actions
        ret['changes'].setdefault('old', {})['actions'] = _describe['actions']
Severity: Major
Found in salt/states/boto_iot.py and 1 other location - About 2 hrs to fix
salt/states/boto_cloudtrail.py on lines 251..254

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

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

    if subnet_name:
        resource = __salt__['boto_vpc.get_resource_id']('subnet', subnet_name,
                                                        region=region, key=key,
                                                        keyid=keyid,
                                                        profile=profile)
Severity: Major
Found in salt/modules/boto_ec2.py and 1 other location - About 2 hrs to fix
salt/modules/boto_ec2.py on lines 987..994

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

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 system_info():
    '''
    Return System information

    CLI Example:
Severity: Major
Found in salt/modules/drac.py and 1 other location - About 2 hrs to fix
salt/modules/drac.py on lines 79..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 67.

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 add_source(zone, source, permanent=True):
    '''
    Bind a source to a zone

    .. versionadded:: 2016.3.0
Severity: Major
Found in salt/modules/firewalld.py and 1 other location - About 2 hrs to fix
salt/modules/firewalld.py on lines 875..895

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

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

    if r.get('error'):
        ret['result'] = False
        failure_comment = ('Failed to get existing identity pool roles: '
                           '{0}'.format(r['error'].get('message', r['error'])))
        ret['comment'] = '{0}\n{1}'.format(ret['comment'], failure_comment)
Severity: Major
Found in salt/states/boto_cognitoidentity.py and 1 other location - About 2 hrs to fix
salt/states/boto_cognitoidentity.py on lines 112..117

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

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

        if change_tenant:
            __salt__['keystone.user_update'](name=name, tenant=tenant, profile=profile, **connection_args)
            ret['comment'] = 'User "{0}" has been updated'.format(name)
            ret['changes']['Tenant'] = 'Added to "{0}" tenant'.format(tenant)
Severity: Major
Found in salt/states/keystone.py and 1 other location - About 2 hrs to fix
salt/states/keystone.py on lines 222..225

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

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

            if line.startswith('%include'):
                rules = shlex.split(line)
                if not ks_opts['include']:
                    ks_opts['include'] = []
                ks_opts['include'].append(rules[1])
Severity: Major
Found in salt/utils/kickstart.py and 1 other location - About 2 hrs to fix
salt/utils/kickstart.py on lines 1025..1029

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

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

    __utils__['cloud.fire_event'](
        'event',
        'starting create',
        'salt/cloud/{0}/creating'.format(vm_info['name']),
        args=__utils__['cloud.filter_event']('creating', vm_info, ['name', 'profile', 'provider', 'driver']),
Severity: Major
Found in salt/cloud/clouds/virtualbox.py and 37 other locations - About 2 hrs to fix
salt/cloud/clouds/aliyun.py on lines 625..631
salt/cloud/clouds/aliyun.py on lines 732..738
salt/cloud/clouds/azurearm.py on lines 1349..1359
salt/cloud/clouds/azurearm.py on lines 1398..1406
salt/cloud/clouds/azurearm.py on lines 1480..1489
salt/cloud/clouds/digitalocean.py on lines 287..293
salt/cloud/clouds/digitalocean.py on lines 537..543
salt/cloud/clouds/dimensiondata.py on lines 207..213
salt/cloud/clouds/dimensiondata.py on lines 337..343
salt/cloud/clouds/ec2.py on lines 2579..2585
salt/cloud/clouds/gce.py on lines 2461..2467
salt/cloud/clouds/gce.py on lines 2551..2557
salt/cloud/clouds/gce.py on lines 2635..2641
salt/cloud/clouds/gogrid.py on lines 96..102
salt/cloud/clouds/gogrid.py on lines 180..186
salt/cloud/clouds/joyent.py on lines 274..280
salt/cloud/clouds/joyent.py on lines 325..331
salt/cloud/clouds/lxc.py on lines 440..446
salt/cloud/clouds/lxc.py on lines 460..466
salt/cloud/clouds/lxc.py on lines 488..494
salt/cloud/clouds/msazure.py on lines 429..435
salt/cloud/clouds/msazure.py on lines 683..689
salt/cloud/clouds/nova.py on lines 961..967
salt/cloud/clouds/opennebula.py on lines 1006..1012
salt/cloud/clouds/openstack.py on lines 684..690
salt/cloud/clouds/packet.py on lines 347..353
salt/cloud/clouds/parallels.py on lines 287..293
salt/cloud/clouds/parallels.py on lines 356..362
salt/cloud/clouds/proxmox.py on lines 578..585
salt/cloud/clouds/qingcloud.py on lines 668..674
salt/cloud/clouds/qingcloud.py on lines 738..744
salt/cloud/clouds/scaleway.py on lines 200..206
salt/cloud/clouds/scaleway.py on lines 304..310
salt/cloud/clouds/vmware.py on lines 2543..2549
salt/cloud/clouds/vmware.py on lines 3072..3078
salt/cloud/clouds/vultrpy.py on lines 292..298
salt/cloud/clouds/vultrpy.py on lines 465..471

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

    __utils__['cloud.fire_event'](
        'event',
        'create instance',
        'salt/cloud/{0}/creating'.format(vm_['name']),
        args=__utils__['cloud.filter_event']('creating', vm_, ['name', 'profile', 'provider', 'driver']),
Severity: Major
Found in salt/cloud/clouds/gce.py and 37 other locations - About 2 hrs to fix
salt/cloud/clouds/aliyun.py on lines 625..631
salt/cloud/clouds/aliyun.py on lines 732..738
salt/cloud/clouds/azurearm.py on lines 1349..1359
salt/cloud/clouds/azurearm.py on lines 1398..1406
salt/cloud/clouds/azurearm.py on lines 1480..1489
salt/cloud/clouds/digitalocean.py on lines 287..293
salt/cloud/clouds/digitalocean.py on lines 537..543
salt/cloud/clouds/dimensiondata.py on lines 207..213
salt/cloud/clouds/dimensiondata.py on lines 337..343
salt/cloud/clouds/ec2.py on lines 2579..2585
salt/cloud/clouds/gce.py on lines 2551..2557
salt/cloud/clouds/gce.py on lines 2635..2641
salt/cloud/clouds/gogrid.py on lines 96..102
salt/cloud/clouds/gogrid.py on lines 180..186
salt/cloud/clouds/joyent.py on lines 274..280
salt/cloud/clouds/joyent.py on lines 325..331
salt/cloud/clouds/lxc.py on lines 440..446
salt/cloud/clouds/lxc.py on lines 460..466
salt/cloud/clouds/lxc.py on lines 488..494
salt/cloud/clouds/msazure.py on lines 429..435
salt/cloud/clouds/msazure.py on lines 683..689
salt/cloud/clouds/nova.py on lines 961..967
salt/cloud/clouds/opennebula.py on lines 1006..1012
salt/cloud/clouds/openstack.py on lines 684..690
salt/cloud/clouds/packet.py on lines 347..353
salt/cloud/clouds/parallels.py on lines 287..293
salt/cloud/clouds/parallels.py on lines 356..362
salt/cloud/clouds/proxmox.py on lines 578..585
salt/cloud/clouds/qingcloud.py on lines 668..674
salt/cloud/clouds/qingcloud.py on lines 738..744
salt/cloud/clouds/scaleway.py on lines 200..206
salt/cloud/clouds/scaleway.py on lines 304..310
salt/cloud/clouds/virtualbox.py on lines 176..182
salt/cloud/clouds/vmware.py on lines 2543..2549
salt/cloud/clouds/vmware.py on lines 3072..3078
salt/cloud/clouds/vultrpy.py on lines 292..298
salt/cloud/clouds/vultrpy.py on lines 465..471

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

    __utils__['cloud.fire_event'](
        'event',
        'starting create',
        'salt/cloud/{0}/creating'.format(vm_['name']),
        args=__utils__['cloud.filter_event']('creating', vm_, ['name', 'profile', 'provider', 'driver']),
Severity: Major
Found in salt/cloud/clouds/aliyun.py and 37 other locations - About 2 hrs to fix
salt/cloud/clouds/aliyun.py on lines 732..738
salt/cloud/clouds/azurearm.py on lines 1349..1359
salt/cloud/clouds/azurearm.py on lines 1398..1406
salt/cloud/clouds/azurearm.py on lines 1480..1489
salt/cloud/clouds/digitalocean.py on lines 287..293
salt/cloud/clouds/digitalocean.py on lines 537..543
salt/cloud/clouds/dimensiondata.py on lines 207..213
salt/cloud/clouds/dimensiondata.py on lines 337..343
salt/cloud/clouds/ec2.py on lines 2579..2585
salt/cloud/clouds/gce.py on lines 2461..2467
salt/cloud/clouds/gce.py on lines 2551..2557
salt/cloud/clouds/gce.py on lines 2635..2641
salt/cloud/clouds/gogrid.py on lines 96..102
salt/cloud/clouds/gogrid.py on lines 180..186
salt/cloud/clouds/joyent.py on lines 274..280
salt/cloud/clouds/joyent.py on lines 325..331
salt/cloud/clouds/lxc.py on lines 440..446
salt/cloud/clouds/lxc.py on lines 460..466
salt/cloud/clouds/lxc.py on lines 488..494
salt/cloud/clouds/msazure.py on lines 429..435
salt/cloud/clouds/msazure.py on lines 683..689
salt/cloud/clouds/nova.py on lines 961..967
salt/cloud/clouds/opennebula.py on lines 1006..1012
salt/cloud/clouds/openstack.py on lines 684..690
salt/cloud/clouds/packet.py on lines 347..353
salt/cloud/clouds/parallels.py on lines 287..293
salt/cloud/clouds/parallels.py on lines 356..362
salt/cloud/clouds/proxmox.py on lines 578..585
salt/cloud/clouds/qingcloud.py on lines 668..674
salt/cloud/clouds/qingcloud.py on lines 738..744
salt/cloud/clouds/scaleway.py on lines 200..206
salt/cloud/clouds/scaleway.py on lines 304..310
salt/cloud/clouds/virtualbox.py on lines 176..182
salt/cloud/clouds/vmware.py on lines 2543..2549
salt/cloud/clouds/vmware.py on lines 3072..3078
salt/cloud/clouds/vultrpy.py on lines 292..298
salt/cloud/clouds/vultrpy.py on lines 465..471

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

    __utils__['cloud.fire_event'](
        'event',
        'starting create',
        'salt/cloud/{0}/creating'.format(vm_['name']),
        args=__utils__['cloud.filter_event']('creating', vm_, ['name', 'profile', 'provider', 'driver']),
Severity: Major
Found in salt/cloud/clouds/dimensiondata.py and 37 other locations - About 2 hrs to fix
salt/cloud/clouds/aliyun.py on lines 625..631
salt/cloud/clouds/aliyun.py on lines 732..738
salt/cloud/clouds/azurearm.py on lines 1349..1359
salt/cloud/clouds/azurearm.py on lines 1398..1406
salt/cloud/clouds/azurearm.py on lines 1480..1489
salt/cloud/clouds/digitalocean.py on lines 287..293
salt/cloud/clouds/digitalocean.py on lines 537..543
salt/cloud/clouds/dimensiondata.py on lines 337..343
salt/cloud/clouds/ec2.py on lines 2579..2585
salt/cloud/clouds/gce.py on lines 2461..2467
salt/cloud/clouds/gce.py on lines 2551..2557
salt/cloud/clouds/gce.py on lines 2635..2641
salt/cloud/clouds/gogrid.py on lines 96..102
salt/cloud/clouds/gogrid.py on lines 180..186
salt/cloud/clouds/joyent.py on lines 274..280
salt/cloud/clouds/joyent.py on lines 325..331
salt/cloud/clouds/lxc.py on lines 440..446
salt/cloud/clouds/lxc.py on lines 460..466
salt/cloud/clouds/lxc.py on lines 488..494
salt/cloud/clouds/msazure.py on lines 429..435
salt/cloud/clouds/msazure.py on lines 683..689
salt/cloud/clouds/nova.py on lines 961..967
salt/cloud/clouds/opennebula.py on lines 1006..1012
salt/cloud/clouds/openstack.py on lines 684..690
salt/cloud/clouds/packet.py on lines 347..353
salt/cloud/clouds/parallels.py on lines 287..293
salt/cloud/clouds/parallels.py on lines 356..362
salt/cloud/clouds/proxmox.py on lines 578..585
salt/cloud/clouds/qingcloud.py on lines 668..674
salt/cloud/clouds/qingcloud.py on lines 738..744
salt/cloud/clouds/scaleway.py on lines 200..206
salt/cloud/clouds/scaleway.py on lines 304..310
salt/cloud/clouds/virtualbox.py on lines 176..182
salt/cloud/clouds/vmware.py on lines 2543..2549
salt/cloud/clouds/vmware.py on lines 3072..3078
salt/cloud/clouds/vultrpy.py on lines 292..298
salt/cloud/clouds/vultrpy.py on lines 465..471

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

Severity
Category
Status
Source
Language