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 res is None:
            ret['result'] = False
            msg = 'Error occurred while updating origin access identity `{}`.'.format(Name)
            log.error(msg)
            ret['comment'] = msg
Severity: Major
Found in salt/states/boto_cloudfront.py and 7 other locations - About 1 hr to fix
salt/states/boto_cloudfront.py on lines 483..488
salt/states/boto_cloudfront.py on lines 551..556
salt/states/boto_cloudfront.py on lines 915..920
salt/states/boto_cloudfront.py on lines 934..939
salt/states/boto_cloudfront.py on lines 1039..1044
salt/states/boto_cloudfront.py on lines 1153..1158
salt/states/boto_cloudfront.py on lines 1168..1173

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

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 deleted is False:
        ret['result'] = False
        msg = 'Error deleting CloudFront origin access identity `{}`'.format(ref)
        log.error(msg)
        ret['comment'] = msg
Severity: Major
Found in salt/states/boto_cloudfront.py and 7 other locations - About 1 hr to fix
salt/states/boto_cloudfront.py on lines 483..488
salt/states/boto_cloudfront.py on lines 551..556
salt/states/boto_cloudfront.py on lines 915..920
salt/states/boto_cloudfront.py on lines 934..939
salt/states/boto_cloudfront.py on lines 1039..1044
salt/states/boto_cloudfront.py on lines 1070..1075
salt/states/boto_cloudfront.py on lines 1153..1158

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

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 disabled is None:
            ret['result'] = False
            msg = 'Error disabling CloudFront distribution `{}`'.format(ref)
            log.error(msg)
            ret['comment'] = msg
Severity: Major
Found in salt/states/boto_cloudfront.py and 7 other locations - About 1 hr to fix
salt/states/boto_cloudfront.py on lines 483..488
salt/states/boto_cloudfront.py on lines 551..556
salt/states/boto_cloudfront.py on lines 915..920
salt/states/boto_cloudfront.py on lines 1039..1044
salt/states/boto_cloudfront.py on lines 1070..1075
salt/states/boto_cloudfront.py on lines 1153..1158
salt/states/boto_cloudfront.py on lines 1168..1173

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

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

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

    if not os.path.isdir(list_cachedir):
        try:
            os.makedirs(list_cachedir)
        except os.error:
            log.critical('Unable to make cachedir %s', list_cachedir)
Severity: Major
Found in salt/fileserver/svnfs.py and 2 other locations - About 1 hr to fix
salt/fileserver/hgfs.py on lines 812..817
salt/fileserver/roots.py on lines 313..318

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

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 old is None:
        ret['result'] = False
        msg = 'Error getting state of CloudFront distribution `{}`.'.format(ref)
        log.error(msg)
        ret['comment'] = msg
Severity: Major
Found in salt/states/boto_cloudfront.py and 7 other locations - About 1 hr to fix
salt/states/boto_cloudfront.py on lines 483..488
salt/states/boto_cloudfront.py on lines 551..556
salt/states/boto_cloudfront.py on lines 934..939
salt/states/boto_cloudfront.py on lines 1039..1044
salt/states/boto_cloudfront.py on lines 1070..1075
salt/states/boto_cloudfront.py on lines 1153..1158
salt/states/boto_cloudfront.py on lines 1168..1173

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

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 old is None:
        ret['result'] = False
        msg = 'Error getting state of CloudFront origin access identity `{}`.'.format(ref)
        log.error(msg)
        ret['comment'] = msg
Severity: Major
Found in salt/states/boto_cloudfront.py and 7 other locations - About 1 hr to fix
salt/states/boto_cloudfront.py on lines 483..488
salt/states/boto_cloudfront.py on lines 551..556
salt/states/boto_cloudfront.py on lines 915..920
salt/states/boto_cloudfront.py on lines 934..939
salt/states/boto_cloudfront.py on lines 1039..1044
salt/states/boto_cloudfront.py on lines 1070..1075
salt/states/boto_cloudfront.py on lines 1168..1173

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

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 res is None:
            ret['result'] = False
            msg = 'Error occurred while creating distribution `{}`.'.format(Name)
            log.error(msg)
            ret['comment'] = msg
Severity: Major
Found in salt/states/boto_cloudfront.py and 7 other locations - About 1 hr to fix
salt/states/boto_cloudfront.py on lines 551..556
salt/states/boto_cloudfront.py on lines 915..920
salt/states/boto_cloudfront.py on lines 934..939
salt/states/boto_cloudfront.py on lines 1039..1044
salt/states/boto_cloudfront.py on lines 1070..1075
salt/states/boto_cloudfront.py on lines 1153..1158
salt/states/boto_cloudfront.py on lines 1168..1173

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

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 res is None:
            ret['result'] = False
            msg = 'Failed to create CloudFront origin access identity `{}`.'.format(Name)
            log.error(msg)
            ret['comment'] = msg
Severity: Major
Found in salt/states/boto_cloudfront.py and 7 other locations - About 1 hr to fix
salt/states/boto_cloudfront.py on lines 483..488
salt/states/boto_cloudfront.py on lines 551..556
salt/states/boto_cloudfront.py on lines 915..920
salt/states/boto_cloudfront.py on lines 934..939
salt/states/boto_cloudfront.py on lines 1070..1075
salt/states/boto_cloudfront.py on lines 1153..1158
salt/states/boto_cloudfront.py on lines 1168..1173

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

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

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

    try:
        call = __salt__['cabal.install'](pkgs=pkg_list,
                                         user=user,
                                         install_global=install_global,
                                         env=env)
Severity: Major
Found in salt/states/cabal.py and 2 other locations - About 1 hr to fix
salt/states/bower.py on lines 159..178
salt/states/npm.py on lines 197..211

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

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

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

    try:
        cmd_args = {
            'pkg': None,
            'dir': dir,
            'pkgs': None,
Severity: Major
Found in salt/states/bower.py and 2 other locations - About 1 hr to fix
salt/states/cabal.py on lines 148..157
salt/states/npm.py on lines 197..211

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

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

def _get_token():
    '''
    Retrieves and return the Telegram's configured token

    :return:    String: the token string
Severity: Major
Found in salt/modules/telegram.py and 6 other locations - About 1 hr to fix
salt/modules/mattermost.py on lines 41..52
salt/modules/mattermost.py on lines 55..66
salt/modules/msteams.py on lines 40..51
salt/modules/telegram.py on lines 43..54
salt/runners/mattermost.py on lines 47..57
salt/runners/mattermost.py on lines 60..70

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

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

def _get_api_url():
    '''
    Retrieves and return the Mattermost's configured api url
    :return:            String: the api url string
    '''
Severity: Major
Found in salt/runners/mattermost.py and 6 other locations - About 1 hr to fix
salt/modules/mattermost.py on lines 41..52
salt/modules/mattermost.py on lines 55..66
salt/modules/msteams.py on lines 40..51
salt/modules/telegram.py on lines 43..54
salt/modules/telegram.py on lines 57..68
salt/runners/mattermost.py on lines 47..57

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

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

    if remove_probes:
        removed = _delete_rpm_probes(remove_probes)
        if removed.get('result'):
            config_change_expected = True
        else:
Severity: Major
Found in salt/states/probes.py and 5 other locations - About 1 hr to fix
salt/states/netusers.py on lines 394..401
salt/states/netusers.py on lines 404..411
salt/states/netusers.py on lines 414..421
salt/states/probes.py on lines 395..402
salt/states/probes.py on lines 405..412

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

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

    if status['retcode'] not in [0, 1641, 3010]:
        ret['comment'] = 'Failed to install {0}: {1}'\
            .format(name, status['stdout'])
        ret['result'] = False
Severity: Major
Found in salt/states/win_dism.py and 5 other locations - About 1 hr to fix
salt/states/win_dism.py on lines 144..147
salt/states/win_dism.py on lines 215..218
salt/states/win_dism.py on lines 275..278
salt/states/win_dism.py on lines 352..355
salt/states/win_dism.py on lines 430..433

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

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

    if status['retcode'] not in [0, 1641, 3010]:
        ret['comment'] = 'Failed to install {0}: {1}' \
            .format(name, status['stdout'])
        ret['result'] = False
Severity: Major
Found in salt/states/win_dism.py and 5 other locations - About 1 hr to fix
salt/states/win_dism.py on lines 88..91
salt/states/win_dism.py on lines 144..147
salt/states/win_dism.py on lines 275..278
salt/states/win_dism.py on lines 352..355
salt/states/win_dism.py on lines 430..433

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

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

    if add_probes:
        added = _set_rpm_probes(add_probes)
        if added.get('result'):
            config_change_expected = True
        else:
Severity: Major
Found in salt/states/probes.py and 5 other locations - About 1 hr to fix
salt/states/netusers.py on lines 394..401
salt/states/netusers.py on lines 404..411
salt/states/netusers.py on lines 414..421
salt/states/probes.py on lines 405..412
salt/states/probes.py on lines 415..422

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 55.

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 res is None:
                ret['result'] = False
                msg = 'Error occurred while updating distribution `{}`.'.format(Name)
                log.error(msg)
                ret['comment'] = msg
Severity: Major
Found in salt/states/boto_cloudfront.py and 7 other locations - About 1 hr to fix
salt/states/boto_cloudfront.py on lines 483..488
salt/states/boto_cloudfront.py on lines 915..920
salt/states/boto_cloudfront.py on lines 934..939
salt/states/boto_cloudfront.py on lines 1039..1044
salt/states/boto_cloudfront.py on lines 1070..1075
salt/states/boto_cloudfront.py on lines 1153..1158
salt/states/boto_cloudfront.py on lines 1168..1173

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

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

def _get_hook_url():
    '''
    Return hook_url from minion/master config file
    or from pillar
    '''
Severity: Major
Found in salt/modules/msteams.py and 6 other locations - About 1 hr to fix
salt/modules/mattermost.py on lines 41..52
salt/modules/mattermost.py on lines 55..66
salt/modules/telegram.py on lines 43..54
salt/modules/telegram.py on lines 57..68
salt/runners/mattermost.py on lines 47..57
salt/runners/mattermost.py on lines 60..70

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

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

def _get_hook():
    '''
    Retrieves and return the Mattermost's configured hook
    :return:            String: the hook string
    '''
Severity: Major
Found in salt/runners/mattermost.py and 6 other locations - About 1 hr to fix
salt/modules/mattermost.py on lines 41..52
salt/modules/mattermost.py on lines 55..66
salt/modules/msteams.py on lines 40..51
salt/modules/telegram.py on lines 43..54
salt/modules/telegram.py on lines 57..68
salt/runners/mattermost.py on lines 60..70

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

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

    if update_probes:
        updated = _set_rpm_probes(update_probes)
        if updated.get('result'):
            config_change_expected = True
        else:
Severity: Major
Found in salt/states/probes.py and 5 other locations - About 1 hr to fix
salt/states/netusers.py on lines 394..401
salt/states/netusers.py on lines 404..411
salt/states/netusers.py on lines 414..421
salt/states/probes.py on lines 395..402
salt/states/probes.py on lines 415..422

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 55.

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