saltstack/salt

View on GitHub

Showing 7,542 of 17,590 total issues

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

def _error(ret, err_msg):
    ret['result'] = False
    ret['comment'] = err_msg
    if 'changes' not in ret:
        ret['changes'] = {}
Severity: Major
Found in salt/states/lxd_profile.py and 11 other locations - About 1 hr to fix
salt/states/lxd.py on lines 285..290
salt/states/lxd.py on lines 293..298
salt/states/lxd.py on lines 301..306
salt/states/lxd_container.py on lines 881..886
salt/states/lxd_container.py on lines 889..894
salt/states/lxd_container.py on lines 897..902
salt/states/lxd_image.py on lines 381..386
salt/states/lxd_image.py on lines 389..394
salt/states/lxd_image.py on lines 397..402
salt/states/lxd_profile.py on lines 276..281
salt/states/lxd_profile.py on lines 284..289

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

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

def _success(ret, success_msg):
    ret['result'] = True
    ret['comment'] = success_msg
    if 'changes' not in ret:
        ret['changes'] = {}
Severity: Major
Found in salt/states/lxd_container.py and 11 other locations - About 1 hr to fix
salt/states/lxd.py on lines 285..290
salt/states/lxd.py on lines 293..298
salt/states/lxd.py on lines 301..306
salt/states/lxd_container.py on lines 889..894
salt/states/lxd_container.py on lines 897..902
salt/states/lxd_image.py on lines 381..386
salt/states/lxd_image.py on lines 389..394
salt/states/lxd_image.py on lines 397..402
salt/states/lxd_profile.py on lines 276..281
salt/states/lxd_profile.py on lines 284..289
salt/states/lxd_profile.py on lines 292..297

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

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

def _error(ret, err_msg):
    ret['result'] = False
    ret['comment'] = err_msg
    if 'changes' not in ret:
        ret['changes'] = {}
Severity: Major
Found in salt/states/lxd.py and 11 other locations - About 1 hr to fix
salt/states/lxd.py on lines 285..290
salt/states/lxd.py on lines 293..298
salt/states/lxd_container.py on lines 881..886
salt/states/lxd_container.py on lines 889..894
salt/states/lxd_container.py on lines 897..902
salt/states/lxd_image.py on lines 381..386
salt/states/lxd_image.py on lines 389..394
salt/states/lxd_image.py on lines 397..402
salt/states/lxd_profile.py on lines 276..281
salt/states/lxd_profile.py on lines 284..289
salt/states/lxd_profile.py on lines 292..297

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

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

def _error(ret, err_msg):
    ret['result'] = False
    ret['comment'] = err_msg
    if 'changes' not in ret:
        ret['changes'] = {}
Severity: Major
Found in salt/states/lxd_container.py and 11 other locations - About 1 hr to fix
salt/states/lxd.py on lines 285..290
salt/states/lxd.py on lines 293..298
salt/states/lxd.py on lines 301..306
salt/states/lxd_container.py on lines 881..886
salt/states/lxd_container.py on lines 889..894
salt/states/lxd_image.py on lines 381..386
salt/states/lxd_image.py on lines 389..394
salt/states/lxd_image.py on lines 397..402
salt/states/lxd_profile.py on lines 276..281
salt/states/lxd_profile.py on lines 284..289
salt/states/lxd_profile.py on lines 292..297

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

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

def _unchanged(ret, msg):
    ret['result'] = None
    ret['comment'] = msg
    if 'changes' not in ret:
        ret['changes'] = {}
Severity: Major
Found in salt/states/lxd.py and 11 other locations - About 1 hr to fix
salt/states/lxd.py on lines 285..290
salt/states/lxd.py on lines 301..306
salt/states/lxd_container.py on lines 881..886
salt/states/lxd_container.py on lines 889..894
salt/states/lxd_container.py on lines 897..902
salt/states/lxd_image.py on lines 381..386
salt/states/lxd_image.py on lines 389..394
salt/states/lxd_image.py on lines 397..402
salt/states/lxd_profile.py on lines 276..281
salt/states/lxd_profile.py on lines 284..289
salt/states/lxd_profile.py on lines 292..297

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

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

def _success(ret, success_msg):
    ret['result'] = True
    ret['comment'] = success_msg
    if 'changes' not in ret:
        ret['changes'] = {}
Severity: Major
Found in salt/states/lxd_image.py and 11 other locations - About 1 hr to fix
salt/states/lxd.py on lines 285..290
salt/states/lxd.py on lines 293..298
salt/states/lxd.py on lines 301..306
salt/states/lxd_container.py on lines 881..886
salt/states/lxd_container.py on lines 889..894
salt/states/lxd_container.py on lines 897..902
salt/states/lxd_image.py on lines 389..394
salt/states/lxd_image.py on lines 397..402
salt/states/lxd_profile.py on lines 276..281
salt/states/lxd_profile.py on lines 284..289
salt/states/lxd_profile.py on lines 292..297

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

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

def _error(ret, err_msg):
    ret['result'] = False
    ret['comment'] = err_msg
    if 'changes' not in ret:
        ret['changes'] = {}
Severity: Major
Found in salt/states/lxd_image.py and 11 other locations - About 1 hr to fix
salt/states/lxd.py on lines 285..290
salt/states/lxd.py on lines 293..298
salt/states/lxd.py on lines 301..306
salt/states/lxd_container.py on lines 881..886
salt/states/lxd_container.py on lines 889..894
salt/states/lxd_container.py on lines 897..902
salt/states/lxd_image.py on lines 381..386
salt/states/lxd_image.py on lines 389..394
salt/states/lxd_profile.py on lines 276..281
salt/states/lxd_profile.py on lines 284..289
salt/states/lxd_profile.py on lines 292..297

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

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

def _unchanged(ret, msg):
    ret['result'] = None
    ret['comment'] = msg
    if 'changes' not in ret:
        ret['changes'] = {}
Severity: Major
Found in salt/states/lxd_image.py and 11 other locations - About 1 hr to fix
salt/states/lxd.py on lines 285..290
salt/states/lxd.py on lines 293..298
salt/states/lxd.py on lines 301..306
salt/states/lxd_container.py on lines 881..886
salt/states/lxd_container.py on lines 889..894
salt/states/lxd_container.py on lines 897..902
salt/states/lxd_image.py on lines 381..386
salt/states/lxd_image.py on lines 397..402
salt/states/lxd_profile.py on lines 276..281
salt/states/lxd_profile.py on lines 284..289
salt/states/lxd_profile.py on lines 292..297

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

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

def _success(ret, success_msg):
    ret['result'] = True
    ret['comment'] = success_msg
    if 'changes' not in ret:
        ret['changes'] = {}
Severity: Major
Found in salt/states/lxd_profile.py and 11 other locations - About 1 hr to fix
salt/states/lxd.py on lines 285..290
salt/states/lxd.py on lines 293..298
salt/states/lxd.py on lines 301..306
salt/states/lxd_container.py on lines 881..886
salt/states/lxd_container.py on lines 889..894
salt/states/lxd_container.py on lines 897..902
salt/states/lxd_image.py on lines 381..386
salt/states/lxd_image.py on lines 389..394
salt/states/lxd_image.py on lines 397..402
salt/states/lxd_profile.py on lines 284..289
salt/states/lxd_profile.py on lines 292..297

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

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

def _unchanged(ret, msg):
    ret['result'] = None
    ret['comment'] = msg
    if 'changes' not in ret:
        ret['changes'] = {}
Severity: Major
Found in salt/states/lxd_container.py and 11 other locations - About 1 hr to fix
salt/states/lxd.py on lines 285..290
salt/states/lxd.py on lines 293..298
salt/states/lxd.py on lines 301..306
salt/states/lxd_container.py on lines 881..886
salt/states/lxd_container.py on lines 897..902
salt/states/lxd_image.py on lines 381..386
salt/states/lxd_image.py on lines 389..394
salt/states/lxd_image.py on lines 397..402
salt/states/lxd_profile.py on lines 276..281
salt/states/lxd_profile.py on lines 284..289
salt/states/lxd_profile.py on lines 292..297

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

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:
            base_template_name = record['other_config']['base_template_name']
        except Exception:
            base_template_name = None
            log.debug(
Severity: Major
Found in salt/cloud/clouds/xen.py and 2 other locations - About 1 hr to fix
salt/cloud/clouds/xen.py on lines 199..205
salt/cloud/clouds/xen.py on lines 323..329

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

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 out['retcode'] != 0:
        msg = 'Error:  ' + out['stderr']
        log.error(msg)
        return msg
Severity: Major
Found in salt/modules/dpkg_lowpkg.py and 2 other locations - About 1 hr to fix
salt/modules/dpkg_lowpkg.py on lines 191..194
salt/modules/dpkg_lowpkg.py on lines 233..236

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

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 out['retcode'] != 0:
        msg = 'Error:  ' + out['stderr']
        log.error(msg)
        return msg
Severity: Major
Found in salt/modules/dpkg_lowpkg.py and 2 other locations - About 1 hr to fix
salt/modules/dpkg_lowpkg.py on lines 159..162
salt/modules/dpkg_lowpkg.py on lines 233..236

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

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

def _unchanged(ret, msg):
    ret['result'] = None
    ret['comment'] = msg
    if 'changes' not in ret:
        ret['changes'] = {}
Severity: Major
Found in salt/states/lxd_profile.py and 11 other locations - About 1 hr to fix
salt/states/lxd.py on lines 285..290
salt/states/lxd.py on lines 293..298
salt/states/lxd.py on lines 301..306
salt/states/lxd_container.py on lines 881..886
salt/states/lxd_container.py on lines 889..894
salt/states/lxd_container.py on lines 897..902
salt/states/lxd_image.py on lines 381..386
salt/states/lxd_image.py on lines 389..394
salt/states/lxd_image.py on lines 397..402
salt/states/lxd_profile.py on lines 276..281
salt/states/lxd_profile.py on lines 292..297

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

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:
                base_template_name = record['other_config']['base_template_name']
            except Exception:
                base_template_name = None
                log.debug(
Severity: Major
Found in salt/cloud/clouds/xen.py and 2 other locations - About 1 hr to fix
salt/cloud/clouds/xen.py on lines 199..205
salt/cloud/clouds/xen.py on lines 490..496

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

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 out['retcode'] != 0:
        msg = 'Error:  ' + out['stderr']
        log.error(msg)
        return msg
Severity: Major
Found in salt/modules/dpkg_lowpkg.py and 2 other locations - About 1 hr to fix
salt/modules/dpkg_lowpkg.py on lines 159..162
salt/modules/dpkg_lowpkg.py on lines 191..194

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

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:
                base_template_name = record['other_config']['base_template_name']
            except Exception:
                base_template_name = None
                log.debug(
Severity: Major
Found in salt/cloud/clouds/xen.py and 2 other locations - About 1 hr to fix
salt/cloud/clouds/xen.py on lines 323..329
salt/cloud/clouds/xen.py on lines 490..496

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

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

    if 'id' in kwargs:
        data['ID'] = kwargs['id']
    else:
        ret['message'] = 'Required parameter "id" is missing.'
        ret['res'] = False
Severity: Major
Found in salt/modules/consul.py and 4 other locations - About 1 hr to fix
salt/modules/consul.py on lines 571..576
salt/modules/consul.py on lines 1151..1156
salt/modules/consul.py on lines 1450..1455
salt/modules/consul.py on lines 1599..1604

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

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

    if not __salt__['boto_iam.get_user'](user_name, region, key, keyid, profile):
        ret['result'] = False
        ret['comment'] = 'IAM User {0} does not exist.'.format(user_name)
        return ret
Severity: Major
Found in salt/states/boto_iam.py and 4 other locations - About 1 hr to fix
salt/states/boto_elbv2.py on lines 176..179
salt/states/boto_iam.py on lines 229..232
salt/states/boto_iam.py on lines 350..353
salt/states/boto_iam.py on lines 832..835

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

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

        modified = __salt__['bigip.modify_node'](hostname=hostname,
Severity: Major
Found in salt/states/bigip.py and 4 other locations - About 1 hr to fix
salt/modules/napalm_network.py on lines 1981..1981
salt/states/bigip.py on lines 295..295
salt/states/bigip.py on lines 324..324
salt/states/boto_vpc.py on lines 411..411

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

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