saltstack/salt

View on GitHub

Showing 7,542 of 17,590 total issues

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

    policy = __salt__['azurearm_resource.policy_definition_create_or_update'](
Severity: Minor
Found in salt/states/azurearm_resource.py and 2 other locations - About 30 mins to fix
salt/states/azurearm_network.py on lines 1709..1709
salt/states/kubernetes.py on lines 324..324

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

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

    try:
        response = conn.placeOrder(kwargs)
        # Leaving the following line in, commented, for easy debugging
        #response = conn.verifyOrder(kwargs)
    except Exception as exc:
Severity: Minor
Found in salt/cloud/clouds/softlayer_hw.py and 2 other locations - About 30 mins to fix
salt/cloud/clouds/gce.py on lines 1915..1922
salt/cloud/clouds/softlayer.py on lines 412..422

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

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

    try:
        ext['common'] = __salt__['pillar.get']('tls.extensions:common', False)
    except NameError as err:
        log.debug(err)
Severity: Minor
Found in salt/modules/tls.py and 2 other locations - About 30 mins to fix
salt/modules/tls.py on lines 917..920
salt/modules/tls.py on lines 931..934

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

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

        res = __salt__['kubernetes.replace_service'](
Severity: Minor
Found in salt/states/kubernetes.py and 2 other locations - About 30 mins to fix
salt/states/azurearm_network.py on lines 1709..1709
salt/states/azurearm_resource.py on lines 526..526

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

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

    if ret['changes'].get('failed', False):
        ret['comment'] = 'Updates failed'
    else:
        ret['comment'] = 'Updates removed successfully'
Severity: Minor
Found in salt/states/win_wua.py and 2 other locations - About 30 mins to fix
salt/states/win_wua.py on lines 206..209
salt/states/win_wua.py on lines 499..502

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

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

    for key, val in six.iteritems(kwargs):
        if not key.startswith('__'):
            ret[key] = val
Severity: Minor
Found in salt/utils/args.py and 2 other locations - About 30 mins to fix
salt/modules/junos.py on lines 215..218
salt/modules/napalm_mod.py on lines 272..275

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

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

    for karg, warg in six.iteritems(kwargs):
        # remove the __pub args
        if not karg.startswith('__pub_'):
            clean_kwargs[karg] = warg
Severity: Minor
Found in salt/modules/napalm_mod.py and 2 other locations - About 30 mins to fix
salt/modules/junos.py on lines 215..218
salt/utils/args.py on lines 49..51

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

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

        if keep_env is not True:
            full_cmd += 'env -i '
            if 'PATH' not in to_keep:
                full_cmd += '{0} '.format(PATH)
Severity: Minor
Found in salt/modules/container_resource.py and 2 other locations - About 30 mins to fix
salt/modules/container_resource.py on lines 170..173
salt/modules/container_resource.py on lines 205..208

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

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

    if result['retcode'] == 0:
        if re.match('^vmctl: sent request to terminate vm.*', result['stderr']):
            ret['changes'] = True
        else:
            ret['changes'] = False
Severity: Minor
Found in salt/modules/vmctl.py and 2 other locations - About 30 mins to fix
salt/modules/pf.py on lines 220..223
salt/modules/pf.py on lines 292..295

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

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

    try:
        disk = conn.ex_get_volume(disk_name)
    except ResourceNotFoundError as exc:
        log.error(
            'Disk %s was not found. Exception was: %s',
Severity: Minor
Found in salt/cloud/clouds/gce.py and 2 other locations - About 30 mins to fix
salt/cloud/clouds/softlayer.py on lines 412..422
salt/cloud/clouds/softlayer_hw.py on lines 335..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 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

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

    try:
        response = conn.createObject(kwargs)
    except Exception as exc:
        log.error(
            'Error creating %s on SoftLayer\n\n'
Severity: Minor
Found in salt/cloud/clouds/softlayer.py and 2 other locations - About 30 mins to fix
salt/cloud/clouds/gce.py on lines 1915..1922
salt/cloud/clouds/softlayer_hw.py on lines 335..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 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

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

CreateManagedType('vim.cluster.VsanClusterHealthSystem', 'VsanClusterHealthSystem', 'vmodl.ManagedObject', 'vim.version.version9', [], [('queryPhysicalDiskHealthSummary', 'VsanQueryClusterPhysicalDiskHealthSummary', 'vim.version.version9', (('hosts', 'string[]', 'vim.version.version9', 0, None), ('esxRootPassword', 'string', 'vim.version.version9', 0, None), ), (0, 'vim.host.VsanPhysicalDiskHealthSummary[]', 'vim.host.VsanPhysicalDiskHealthSummary[]'), 'System.Read', None), ('queryClusterNetworkPerfTest', 'VsanQueryClusterNetworkPerfTest', 'vim.version.version9', (('hosts', 'string[]', 'vim.version.version9', 0, None), ('esxRootPassword', 'string', 'vim.version.version9', 0, None), ('multicast', 'boolean', 'vim.version.version9', 0, None), ), (0, 'vim.cluster.VsanClusterNetworkLoadTestResult', 'vim.cluster.VsanClusterNetworkLoadTestResult'), 'System.Read', None), ('queryAdvCfgSync', 'VsanQueryClusterAdvCfgSync', 'vim.version.version9', (('hosts', 'string[]', 'vim.version.version9', 0, None), ('esxRootPassword', 'string', 'vim.version.version9', 0, None), ), (0, 'vim.cluster.VsanClusterAdvCfgSyncResult[]', 'vim.cluster.VsanClusterAdvCfgSyncResult[]'), 'System.Read', None), ('repairClusterImmediateObjects', 'VsanRepairClusterImmediateObjects', 'vim.version.version9', (('hosts', 'string[]', 'vim.version.version9', 0, None), ('esxRootPassword', 'string', 'vim.version.version9', 0, None), ('uuids', 'string[]', 'vim.version.version9', 0 | F_OPTIONAL, None), ), (0, 'vim.cluster.VsanClusterHealthSystemObjectsRepairResult', 'vim.cluster.VsanClusterHealthSystemObjectsRepairResult'), 'System.Read', None), ('queryVerifyClusterNetworkSettings', 'VsanQueryVerifyClusterNetworkSettings', 'vim.version.version9', (('hosts', 'string[]', 'vim.version.version9', 0, None), ('esxRootPassword', 'string', 'vim.version.version9', 0, None), ), (0, 'vim.cluster.VsanClusterNetworkHealthResult', 'vim.cluster.VsanClusterNetworkHealthResult'), 'System.Read', None), ('queryClusterCreateVmHealthTest', 'VsanQueryClusterCreateVmHealthTest', 'vim.version.version9', (('hosts', 'string[]', 'vim.version.version9', 0, None), ('esxRootPassword', 'string', 'vim.version.version9', 0, None), ('timeout', 'int', 'vim.version.version9', 0, None), ), (0, 'vim.cluster.VsanClusterCreateVmHealthTestResult', 'vim.cluster.VsanClusterCreateVmHealthTestResult'), 'System.Read', None), ('queryClusterHealthSystemVersions', 'VsanQueryClusterHealthSystemVersions', 'vim.version.version9', (('hosts', 'string[]', 'vim.version.version9', 0, None), ('esxRootPassword', 'string', 'vim.version.version9', 0, None), ), (0, 'vim.cluster.VsanClusterHealthSystemVersionResult', 'vim.cluster.VsanClusterHealthSystemVersionResult'), 'System.Read', None), ('getClusterHclInfo', 'VsanClusterGetHclInfo', 'vim.version.version9', (('hosts', 'string[]', 'vim.version.version9', 0, None), ('esxRootPassword', 'string', 'vim.version.version9', 0, None), ), (0, 'vim.cluster.VsanClusterHclInfo', 'vim.cluster.VsanClusterHclInfo'), 'System.Read', None), ('queryCheckLimits', 'VsanQueryClusterCheckLimits', 'vim.version.version9', (('hosts', 'string[]', 'vim.version.version9', 0, None), ('esxRootPassword', 'string', 'vim.version.version9', 0, None), ), (0, 'vim.cluster.VsanClusterLimitHealthResult', 'vim.cluster.VsanClusterLimitHealthResult'), 'System.Read', None), ('queryCaptureVsanPcap', 'VsanQueryClusterCaptureVsanPcap', 'vim.version.version9', (('hosts', 'string[]', 'vim.version.version9', 0, None), ('esxRootPassword', 'string', 'vim.version.version9', 0, None), ('duration', 'int', 'vim.version.version9', 0, None), ('vmknic', 'vim.cluster.VsanClusterHostVmknicMapping[]', 'vim.version.version9', 0 | F_OPTIONAL, None), ('includeRawPcap', 'boolean', 'vim.version.version9', 0 | F_OPTIONAL, None), ('includeIgmp', 'boolean', 'vim.version.version9', 0 | F_OPTIONAL, None), ('cmmdsMsgTypeFilter', 'string[]', 'vim.version.version9', 0 | F_OPTIONAL, None), ('cmmdsPorts', 'int[]', 'vim.version.version9', 0 | F_OPTIONAL, None), ('clusterUuid', 'string', 'vim.version.version9', 0 | F_OPTIONAL, None), ), (0, 'vim.cluster.VsanVsanClusterPcapResult', 'vim.cluster.VsanVsanClusterPcapResult'), 'System.Read', None), ('checkClusterClomdLiveness', 'VsanCheckClusterClomdLiveness', 'vim.version.version9', (('hosts', 'string[]', 'vim.version.version9', 0, None), ('esxRootPassword', 'string', 'vim.version.version9', 0, None), ), (0, 'vim.cluster.VsanClusterClomdLivenessResult', 'vim.cluster.VsanClusterClomdLivenessResult'), 'System.Read', None), ])
Severity: Minor
Found in salt/ext/vsan/vsanmgmtObjects.py and 2 other locations - About 30 mins to fix
salt/ext/vsan/vsanmgmtObjects.py on lines 7..7
salt/ext/vsan/vsanmgmtObjects.py on lines 14..14

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

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

        if __opts__['test']:
            msg = 'Launch configuration set to be created.'
            ret['comment'] = msg
            ret['result'] = None
            return ret
Severity: Minor
Found in salt/states/boto_lc.py and 2 other locations - About 30 mins to fix
salt/states/boto_asg.py on lines 542..546
salt/states/boto_vpc.py on lines 1350..1354

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

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

    pub_ip = __salt__['azurearm_network.public_ip_address_create_or_update'](
Severity: Minor
Found in salt/states/azurearm_network.py and 2 other locations - About 30 mins to fix
salt/states/azurearm_resource.py on lines 526..526
salt/states/kubernetes.py on lines 324..324

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

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

    if ret['changes'].get('failed', False):
        ret['comment'] = 'Updates failed'
    else:
        ret['comment'] = 'Updates installed successfully'
Severity: Minor
Found in salt/states/win_wua.py and 2 other locations - About 30 mins to fix
salt/states/win_wua.py on lines 330..333
salt/states/win_wua.py on lines 499..502

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

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

    if urlparsed_scheme and \
            urlparsed_scheme.lower() in string.ascii_lowercase:
        urlparsed_path = ':'.join([urlparsed_scheme, urlparsed_path])
        urlparsed_scheme = 'file'
Severity: Minor
Found in salt/states/archive.py and 2 other locations - About 30 mins to fix
salt/fileclient.py on lines 480..482
salt/modules/file.py on lines 4461..4463

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

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

    try:
        ret = _run_command_in_extended_path(syslog_ng_sbin_dir,
                                            'syslog-ng',
                                            ('-V',))
    except CommandExecutionError as err:
Severity: Minor
Found in salt/modules/syslog_ng.py and 2 other locations - About 30 mins to fix
salt/modules/syslog_ng.py on lines 866..871
salt/modules/syslog_ng.py on lines 933..938

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

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

    elif '__pub_schedule' in kwargs:
        for key, value in six.iteritems(kwargs):
            if not key.startswith('__pub_'):
                op[key] = value
Severity: Minor
Found in salt/modules/junos.py and 2 other locations - About 30 mins to fix
salt/modules/napalm_mod.py on lines 272..275
salt/utils/args.py on lines 49..51

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

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

    try:
        ext['server'] = __salt__['pillar.get']('tls.extensions:server', False)
    except NameError as err:
        log.debug(err)
Severity: Minor
Found in salt/modules/tls.py and 2 other locations - About 30 mins to fix
salt/modules/tls.py on lines 901..904
salt/modules/tls.py on lines 931..934

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

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

        pools = [pool for pool in conn.listAllStoragePools() if name is None or pool.name() == name]
Severity: Minor
Found in salt/modules/virt.py and 2 other locations - About 30 mins to fix
salt/modules/virt.py on lines 4792..4792
salt/modules/virt.py on lines 5458..5458

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

Severity
Category
Status
Source
Language