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 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
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 median_high(name, num, minimum=0, maximum=0, ref=None):
    '''
    Calculates the high 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 157..170
salt/thorium/calc.py on lines 180..193
salt/thorium/calc.py on lines 203..216
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 enable(name, **kwargs):
    '''
    Enable the named service to start at boot

    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 179..190
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 median(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 157..170
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 median_low(name, num, minimum=0, maximum=0, ref=None):
    '''
    Calculates the low 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 157..170
salt/thorium/calc.py on lines 180..193
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

        r = __salt__['boto_lambda.create_event_source_mapping'](
Severity: Major
Found in salt/states/boto_lambda.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/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

        created = __salt__['boto_elasticache.create_subnet_group'](name=name, subnet_ids=subnet_ids,
Severity: Major
Found in salt/states/boto_elasticache.py and 8 other locations - About 35 mins to fix
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/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

def start(name):
    '''
    Start service

    name
Severity: Major
Found in salt/modules/runit.py and 8 other locations - About 35 mins to fix
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
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 stop(name):
    '''
    Stop service

    name
Severity: Major
Found in salt/modules/runit.py and 8 other locations - About 35 mins to fix
salt/modules/runit.py on lines 117..131
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
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

def disable(name, **kwargs):
    '''
    Disable the named service to start at boot

    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 179..190
salt/modules/smf_service.py on lines 267..278

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 mode(name, num, minimum=0, maximum=0, ref=None):
    '''
    Calculates the mode 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 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

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['comment'] = ('Package {0} is set not 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 830..842
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

def restart(name):
    '''
    Restart 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 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

def median_grouped(name, num, minimum=0, maximum=0, ref=None):
    '''
    Calculates the grouped mean of the ``num`` most recent values. Requires a
    list.

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 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 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 stop(name):
    '''
    Stops 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 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

def reload_(name):
    '''
    Reload service

    name
Severity: Major
Found in salt/modules/runit.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 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
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

    name
Severity: Major
Found in salt/modules/runit.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/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
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

    cluster = __salt__['postgres.cluster_create'](
Severity: Major
Found in salt/states/postgres_cluster.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/mount.py on lines 1161..1171

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 start(name):
    '''

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

def unmonitor(name):
    '''
    Unmonitor 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 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

Severity
Category
Status
Source
Language