saltstack/salt

View on GitHub

Showing 7,542 of 17,590 total issues

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

    if 'error' not in rt_tbl:
        ret['result'] = True
        ret['comment'] = 'Route table {0} has been created.'.format(name)
        return ret
Severity: Major
Found in salt/states/azurearm_network.py and 14 other locations - About 35 mins to fix
salt/modules/gpg.py on lines 904..907
salt/states/azurearm_compute.py on lines 257..260
salt/states/azurearm_dns.py on lines 298..301
salt/states/azurearm_dns.py on lines 617..620
salt/states/azurearm_network.py on lines 252..255
salt/states/azurearm_network.py on lines 457..460
salt/states/azurearm_network.py on lines 665..668
salt/states/azurearm_network.py on lines 1046..1049
salt/states/azurearm_network.py on lines 1472..1475
salt/states/azurearm_network.py on lines 1721..1724
salt/states/azurearm_network.py on lines 2041..2044
salt/states/azurearm_network.py on lines 2441..2444
salt/states/azurearm_resource.py on lines 538..541
salt/states/azurearm_resource.py on lines 747..750

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

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

                if 'fingerprint' not in key:
                    ret['res'] = False
                    ret['message'] = 'Fingerprint not found for keyid {0}'.format(keyid)
                    return ret
Severity: Major
Found in salt/modules/gpg.py and 14 other locations - About 35 mins to fix
salt/states/azurearm_compute.py on lines 257..260
salt/states/azurearm_dns.py on lines 298..301
salt/states/azurearm_dns.py on lines 617..620
salt/states/azurearm_network.py on lines 252..255
salt/states/azurearm_network.py on lines 457..460
salt/states/azurearm_network.py on lines 665..668
salt/states/azurearm_network.py on lines 1046..1049
salt/states/azurearm_network.py on lines 1472..1475
salt/states/azurearm_network.py on lines 1721..1724
salt/states/azurearm_network.py on lines 2041..2044
salt/states/azurearm_network.py on lines 2245..2248
salt/states/azurearm_network.py on lines 2441..2444
salt/states/azurearm_resource.py on lines 538..541
salt/states/azurearm_resource.py on lines 747..750

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

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 sync_states(saltenv=None, refresh=True, extmod_whitelist=None, extmod_blacklist=None):
    '''
    .. versionadded:: 0.10.0

    Sync state modules from ``salt://_states`` to the minion
Severity: Major
Found in salt/modules/saltutil.py and 14 other locations - About 35 mins to fix
salt/modules/saltutil.py on lines 192..228
salt/modules/saltutil.py on lines 267..320
salt/modules/saltutil.py on lines 436..473
salt/modules/saltutil.py on lines 476..511
salt/modules/saltutil.py on lines 514..550
salt/modules/saltutil.py on lines 553..588
salt/modules/saltutil.py on lines 591..626
salt/modules/saltutil.py on lines 629..664
salt/modules/saltutil.py on lines 667..701
salt/modules/saltutil.py on lines 707..739
salt/modules/saltutil.py on lines 742..778
salt/modules/saltutil.py on lines 781..817
salt/modules/saltutil.py on lines 844..880
salt/modules/saltutil.py on lines 924..960

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

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 sync_thorium(saltenv=None, refresh=False, extmod_whitelist=None, extmod_blacklist=None):
    '''
    .. versionadded:: 2018.3.0

    Sync Thorium modules from ``salt://_thorium`` to the minion
Severity: Major
Found in salt/modules/saltutil.py and 14 other locations - About 35 mins to fix
salt/modules/saltutil.py on lines 192..228
salt/modules/saltutil.py on lines 267..320
salt/modules/saltutil.py on lines 323..359
salt/modules/saltutil.py on lines 436..473
salt/modules/saltutil.py on lines 476..511
salt/modules/saltutil.py on lines 514..550
salt/modules/saltutil.py on lines 553..588
salt/modules/saltutil.py on lines 591..626
salt/modules/saltutil.py on lines 667..701
salt/modules/saltutil.py on lines 707..739
salt/modules/saltutil.py on lines 742..778
salt/modules/saltutil.py on lines 781..817
salt/modules/saltutil.py on lines 844..880
salt/modules/saltutil.py on lines 924..960

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

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

    if 'error' not in vnet:
        ret['result'] = True
        ret['comment'] = 'Virtual network {0} has been created.'.format(name)
        return ret
Severity: Major
Found in salt/states/azurearm_network.py and 14 other locations - About 35 mins to fix
salt/modules/gpg.py on lines 904..907
salt/states/azurearm_compute.py on lines 257..260
salt/states/azurearm_dns.py on lines 298..301
salt/states/azurearm_dns.py on lines 617..620
salt/states/azurearm_network.py on lines 457..460
salt/states/azurearm_network.py on lines 665..668
salt/states/azurearm_network.py on lines 1046..1049
salt/states/azurearm_network.py on lines 1472..1475
salt/states/azurearm_network.py on lines 1721..1724
salt/states/azurearm_network.py on lines 2041..2044
salt/states/azurearm_network.py on lines 2245..2248
salt/states/azurearm_network.py on lines 2441..2444
salt/states/azurearm_resource.py on lines 538..541
salt/states/azurearm_resource.py on lines 747..750

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

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

    if 'error' not in policy:
        ret['result'] = True
        ret['comment'] = 'Policy assignment {0} has been created.'.format(name)
        return ret
Severity: Major
Found in salt/states/azurearm_resource.py and 14 other locations - About 35 mins to fix
salt/modules/gpg.py on lines 904..907
salt/states/azurearm_compute.py on lines 257..260
salt/states/azurearm_dns.py on lines 298..301
salt/states/azurearm_dns.py on lines 617..620
salt/states/azurearm_network.py on lines 252..255
salt/states/azurearm_network.py on lines 457..460
salt/states/azurearm_network.py on lines 665..668
salt/states/azurearm_network.py on lines 1046..1049
salt/states/azurearm_network.py on lines 1472..1475
salt/states/azurearm_network.py on lines 1721..1724
salt/states/azurearm_network.py on lines 2041..2044
salt/states/azurearm_network.py on lines 2245..2248
salt/states/azurearm_network.py on lines 2441..2444
salt/states/azurearm_resource.py on lines 538..541

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

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

    if 'error' not in rec_set:
        ret['result'] = True
        ret['comment'] = 'Record set {0} has been created.'.format(name)
        return ret
Severity: Major
Found in salt/states/azurearm_dns.py and 14 other locations - About 35 mins to fix
salt/modules/gpg.py on lines 904..907
salt/states/azurearm_compute.py on lines 257..260
salt/states/azurearm_dns.py on lines 298..301
salt/states/azurearm_network.py on lines 252..255
salt/states/azurearm_network.py on lines 457..460
salt/states/azurearm_network.py on lines 665..668
salt/states/azurearm_network.py on lines 1046..1049
salt/states/azurearm_network.py on lines 1472..1475
salt/states/azurearm_network.py on lines 1721..1724
salt/states/azurearm_network.py on lines 2041..2044
salt/states/azurearm_network.py on lines 2245..2248
salt/states/azurearm_network.py on lines 2441..2444
salt/states/azurearm_resource.py on lines 538..541
salt/states/azurearm_resource.py on lines 747..750

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

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

def term(name):
    '''
    Send a TERM to service via s6

    CLI Example:
Severity: Major
Found in salt/modules/s6.py and 8 other locations - About 35 mins to fix
salt/modules/runit.py on lines 117..131
salt/modules/runit.py on lines 135..149
salt/modules/runit.py on lines 153..167
salt/modules/runit.py on lines 171..185
salt/modules/s6.py on lines 52..63
salt/modules/s6.py on lines 66..77
salt/modules/s6.py on lines 94..105
salt/modules/s6.py on lines 108..119

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

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

def restart(name):
    '''
    Restart service via s6. This will stop/start service

    CLI Example:
Severity: Major
Found in salt/modules/s6.py and 8 other locations - About 35 mins to fix
salt/modules/runit.py on lines 117..131
salt/modules/runit.py on lines 135..149
salt/modules/runit.py on lines 153..167
salt/modules/runit.py on lines 171..185
salt/modules/s6.py on lines 52..63
salt/modules/s6.py on lines 66..77
salt/modules/s6.py on lines 80..91
salt/modules/s6.py on lines 94..105

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

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

    elif __grains__['os'] == 'AIX':
        out = __salt__['mount.set_filesystems'](name=fs_file,
                                                device=fs_spec,
                                                fstype=fs_vfstype,
                                                opts=fs_mntops,
Severity: Major
Found in salt/states/mount.py and 8 other locations - About 35 mins to fix
salt/states/boto_elasticache.py on lines 315..315
salt/states/boto_iot.py on lines 687..687
salt/states/boto_iot.py on lines 735..735
salt/states/boto_lambda.py on lines 831..831
salt/states/chocolatey.py on lines 421..421
salt/states/csf.py on lines 93..93
salt/states/mount.py on lines 1117..1118
salt/states/postgres_cluster.py on lines 96..96

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

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

    if host not in data:
        ret['comment'] = 'Host \'{0}\' was not found'.format(host)
        ret['result'] = False
        return ret
Severity: Major
Found in salt/runners/lxc.py and 7 other locations - About 35 mins to fix
salt/modules/beacons.py on lines 584..588
salt/modules/beacons.py on lines 658..662
salt/modules/schedule.py on lines 512..515
salt/states/module.py on lines 519..522
salt/states/selinux.py on lines 155..158
salt/states/selinux.py on lines 235..238
salt/states/selinux.py on lines 306..309

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

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

    exists = __salt__['csf.exists'](method=method,
Severity: Major
Found in salt/states/csf.py and 8 other locations - About 35 mins to fix
salt/states/boto_elasticache.py on lines 315..315
salt/states/boto_iot.py on lines 687..687
salt/states/boto_iot.py on lines 735..735
salt/states/boto_lambda.py on lines 831..831
salt/states/chocolatey.py on lines 421..421
salt/states/mount.py on lines 1117..1118
salt/states/mount.py on lines 1161..1171
salt/states/postgres_cluster.py on lines 96..96

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

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

        elif not salt.utils.data.is_true(state.get('hold', False)):
            if 'test' in __opts__ and __opts__['test']:
                ret[target].update(result=None)
                ret[target]['comment'] = ('Package {0} is set to be held.'
                                          .format(target))
Severity: Major
Found in salt/modules/aptpkg.py and 7 other locations - About 35 mins to fix
salt/modules/aptpkg.py on lines 1199..1211
salt/modules/opkg.py on lines 830..842
salt/modules/opkg.py on lines 902..914
salt/modules/pkgng.py on lines 1942..1959
salt/modules/pkgng.py on lines 2007..2024
salt/modules/yumpkg.py on lines 2144..2162
salt/modules/yumpkg.py on lines 2249..2267

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

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

        if target not in current_locks:
            if 'test' in __opts__ and __opts__['test']:
                ret[target].update(result=None)
                ret[target]['comment'] = ('Package {0} is set to be held.'
                                          .format(target))
Severity: Major
Found in salt/modules/yumpkg.py and 7 other locations - About 35 mins to fix
salt/modules/aptpkg.py on lines 1125..1137
salt/modules/aptpkg.py on lines 1199..1211
salt/modules/opkg.py on lines 830..842
salt/modules/opkg.py on lines 902..914
salt/modules/pkgng.py on lines 1942..1959
salt/modules/pkgng.py on lines 2007..2024
salt/modules/yumpkg.py on lines 2249..2267

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

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

        r = __salt__['boto_iot.replace_topic_rule'](ruleName=ruleName,
Severity: Major
Found in salt/states/boto_iot.py and 8 other locations - About 35 mins to fix
salt/states/boto_elasticache.py on lines 315..315
salt/states/boto_iot.py on lines 687..687
salt/states/boto_lambda.py on lines 831..831
salt/states/chocolatey.py on lines 421..421
salt/states/csf.py on lines 93..93
salt/states/mount.py on lines 1117..1118
salt/states/mount.py on lines 1161..1171
salt/states/postgres_cluster.py on lines 96..96

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

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

    result = __salt__['chocolatey.upgrade'](name=name,
Severity: Major
Found in salt/states/chocolatey.py and 8 other locations - About 35 mins to fix
salt/states/boto_elasticache.py on lines 315..315
salt/states/boto_iot.py on lines 687..687
salt/states/boto_iot.py on lines 735..735
salt/states/boto_lambda.py on lines 831..831
salt/states/csf.py on lines 93..93
salt/states/mount.py on lines 1117..1118
salt/states/mount.py on lines 1161..1171
salt/states/postgres_cluster.py on lines 96..96

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

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

def stop(name):
    '''
    Stops service via monit

    CLI Example:
Severity: Major
Found in salt/modules/monit.py and 7 other locations - About 35 mins to fix
salt/modules/monit.py on lines 28..39
salt/modules/monit.py on lines 57..69
salt/modules/monit.py on lines 72..84
salt/modules/monit.py on lines 87..99
salt/modules/smf_service.py on lines 179..190
salt/modules/smf_service.py on lines 267..278
salt/modules/smf_service.py on lines 281..292

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

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

    if name not in bools:
        ret['comment'] = 'Boolean {0} is not available'.format(name)
        ret['result'] = False
        return ret
Severity: Major
Found in salt/states/selinux.py and 7 other locations - About 35 mins to fix
salt/modules/beacons.py on lines 584..588
salt/modules/beacons.py on lines 658..662
salt/modules/schedule.py on lines 512..515
salt/runners/lxc.py on lines 275..278
salt/states/module.py on lines 519..522
salt/states/selinux.py on lines 235..238
salt/states/selinux.py on lines 306..309

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

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

    if name not in __salt__:
        ret['comment'] = 'Module function {0} is not available'.format(name)
        ret['result'] = False
        return ret
Severity: Major
Found in salt/states/module.py and 7 other locations - About 35 mins to fix
salt/modules/beacons.py on lines 584..588
salt/modules/beacons.py on lines 658..662
salt/modules/schedule.py on lines 512..515
salt/runners/lxc.py on lines 275..278
salt/states/selinux.py on lines 155..158
salt/states/selinux.py on lines 235..238
salt/states/selinux.py on lines 306..309

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

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

    if name not in current_schedule:
        ret['comment'] = 'Job {0} does not exist in schedule.'.format(name)
        ret['result'] = False
        return ret
Severity: Major
Found in salt/modules/schedule.py and 7 other locations - About 35 mins to fix
salt/modules/beacons.py on lines 584..588
salt/modules/beacons.py on lines 658..662
salt/runners/lxc.py on lines 275..278
salt/states/module.py on lines 519..522
salt/states/selinux.py on lines 155..158
salt/states/selinux.py on lines 235..238
salt/states/selinux.py on lines 306..309

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

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