saltstack/salt

View on GitHub

Showing 7,542 of 17,590 total issues

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

        if name not in _beacons:
            ret['comment'] = 'Beacon {0} is not currently configured.' \
                             ''.format(name)
            ret['result'] = False
            return ret
Severity: Major
Found in salt/modules/beacons.py and 7 other locations - About 35 mins to fix
salt/modules/beacons.py on lines 584..588
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 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

def add(name, num, minimum=0, maximum=0, ref=None):
    '''
    Adds together the ``num`` most recent values. Requires a list.

    USAGE:
Severity: Major
Found in salt/thorium/calc.py and 7 other locations - About 35 mins to fix
salt/thorium/calc.py on lines 134..147
salt/thorium/calc.py on lines 157..170
salt/thorium/calc.py on lines 180..193
salt/thorium/calc.py on lines 203..216
salt/thorium/calc.py on lines 226..239
salt/thorium/calc.py on lines 249..263
salt/thorium/calc.py on lines 273..286

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 mean(name, num, minimum=0, maximum=0, ref=None):
    '''
    Calculates the mean of the ``num`` most recent values. Requires a list.

    USAGE:
Severity: Major
Found in salt/thorium/calc.py and 7 other locations - About 35 mins to fix
salt/thorium/calc.py on lines 111..124
salt/thorium/calc.py on lines 134..147
salt/thorium/calc.py on lines 180..193
salt/thorium/calc.py on lines 203..216
salt/thorium/calc.py on lines 226..239
salt/thorium/calc.py on lines 249..263
salt/thorium/calc.py on lines 273..286

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 start(name):
    '''
    Starts 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 66..77
salt/modules/s6.py on lines 80..91
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

        r = __salt__['boto_iot.create_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 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/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 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 not 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 1125..1137
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 not locked(target, **kwargs):
            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/pkgng.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 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 locked(target, **kwargs):
            if __opts__['test']:
                ret[target].update(result=None)
                ret[target]['comment'] = ('Package {0} is set to be unheld.'
                                          .format(target))
Severity: Major
Found in salt/modules/pkgng.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/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 search_locks:
            if __opts__['test']:
                ret[target].update(result=None)
                ret[target]['comment'] = ('Package {0} is set to be unheld.'
                                          .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 2144..2162

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 modules:
        ret['comment'] = 'Module {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 155..158
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

        elif __grains__['os'] == 'AIX':
            out = __salt__['mount.set_filesystems'](name=fs_file,
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 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):
    '''
    Stop the specified service

    CLI Example:
Severity: Major
Found in salt/modules/smf_service.py and 7 other locations - About 35 mins to fix
salt/modules/monit.py on lines 28..39
salt/modules/monit.py on lines 42..54
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 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

def monitor(name):
    '''
    monitor 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 42..54
salt/modules/monit.py on lines 57..69
salt/modules/monit.py on lines 72..84
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 9 locations. Consider refactoring.
Open

def reload_(name):
    '''
    Send a HUP 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 80..91
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 8 locations. Consider refactoring.
Open

        elif state != 'hold':
            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/opkg.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 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 name not in modules:
        ret['comment'] = 'Module {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 155..158
salt/states/selinux.py on lines 235..238

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 mul(name, num, minimum=0, maximum=0, ref=None):
    '''
    Multiplies together the ``num`` most recent values. Requires a list.

    USAGE:
Severity: Major
Found in salt/thorium/calc.py and 7 other locations - About 35 mins to fix
salt/thorium/calc.py on lines 111..124
salt/thorium/calc.py on lines 157..170
salt/thorium/calc.py on lines 180..193
salt/thorium/calc.py on lines 203..216
salt/thorium/calc.py on lines 226..239
salt/thorium/calc.py on lines 249..263
salt/thorium/calc.py on lines 273..286

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

        sls[iface]['gateway'] = ps_opts['d-i']['netcfg']['get_gateway']['argument']
Severity: Major
Found in salt/utils/preseed.py and 5 other locations - About 35 mins to fix
salt/utils/preseed.py on lines 69..69
salt/utils/preseed.py on lines 70..70
salt/utils/preseed.py on lines 72..72
salt/utils/preseed.py on lines 73..73
salt/utils/preseed.py on lines 74..74

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

        sls[iface]['netmask'] = ps_opts['d-i']['netcfg']['get_netmask']['argument']
Severity: Major
Found in salt/utils/preseed.py and 5 other locations - About 35 mins to fix
salt/utils/preseed.py on lines 70..70
salt/utils/preseed.py on lines 71..71
salt/utils/preseed.py on lines 72..72
salt/utils/preseed.py on lines 73..73
salt/utils/preseed.py on lines 74..74

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

def config_set(name, value, host=None, port=None, db=None, password=None):
    '''
    Set redis server configuration values

    CLI Example:
Severity: Major
Found in salt/modules/redismod.py and 5 other locations - About 35 mins to fix
salt/modules/redismod.py on lines 180..191
salt/modules/redismod.py on lines 194..205
salt/modules/redismod.py on lines 270..283
salt/modules/redismod.py on lines 286..297
salt/modules/redismod.py on lines 588..599

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