saltstack/salt

View on GitHub

Showing 7,542 of 17,590 total issues

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

    if vm_:
        info[vm_] = _info(_get_domain(conn, vm_))
    else:
        for domain in _get_domain(conn, iterable=True):
            info[domain.name()] = _info(domain)
Severity: Major
Found in salt/modules/virt.py and 3 other locations - About 2 hrs to fix
salt/modules/virt.py on lines 2194..2198
salt/modules/virt.py on lines 2237..2241
salt/modules/virt.py on lines 3724..3728

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

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

    if not _numeric(kwargs['length']) or not 1 <= kwargs['length'] <= 20:
        ret['res'] = False
        ret['message'] = 'Length of strings must be between 1 and 20'
        return ret
Severity: Major
Found in salt/modules/random_org.py and 11 other locations - About 2 hrs to fix
salt/modules/random_org.py on lines 237..240
salt/modules/random_org.py on lines 242..245
salt/modules/random_org.py on lines 247..250
salt/modules/random_org.py on lines 352..355
salt/modules/random_org.py on lines 444..447
salt/modules/random_org.py on lines 528..531
salt/modules/random_org.py on lines 614..617
salt/modules/random_org.py on lines 619..622
salt/modules/random_org.py on lines 624..627
salt/modules/random_org.py on lines 629..632
salt/modules/random_org.py on lines 705..708

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

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

    if vm_:
        info[vm_] = _info(_get_domain(conn, vm_))
    else:
        for domain in _get_domain(conn, iterable=True):
            info[domain.name()] = _info(domain)
Severity: Major
Found in salt/modules/virt.py and 3 other locations - About 2 hrs to fix
salt/modules/virt.py on lines 2237..2241
salt/modules/virt.py on lines 3724..3728
salt/modules/virt.py on lines 3805..3809

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

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

    if vm_:
        info[vm_] = _info(_get_domain(conn, vm_))
    else:
        for domain in _get_domain(conn, iterable=True):
            info[domain.name()] = _info(domain)
Severity: Major
Found in salt/modules/virt.py and 3 other locations - About 2 hrs to fix
salt/modules/virt.py on lines 2194..2198
salt/modules/virt.py on lines 3724..3728
salt/modules/virt.py on lines 3805..3809

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

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

    if not _numeric(kwargs['maximum']) or not -1000000000 <= kwargs['maximum'] <= 1000000000:
        ret['res'] = False
        ret['message'] = 'Maximum argument must be between -1,000,000,000 and 1,000,000,000'
        return ret
Severity: Major
Found in salt/modules/random_org.py and 11 other locations - About 2 hrs to fix
salt/modules/random_org.py on lines 237..240
salt/modules/random_org.py on lines 242..245
salt/modules/random_org.py on lines 352..355
salt/modules/random_org.py on lines 357..360
salt/modules/random_org.py on lines 444..447
salt/modules/random_org.py on lines 528..531
salt/modules/random_org.py on lines 614..617
salt/modules/random_org.py on lines 619..622
salt/modules/random_org.py on lines 624..627
salt/modules/random_org.py on lines 629..632
salt/modules/random_org.py on lines 705..708

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

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

    if not _numeric(kwargs['number']) or not 1 <= kwargs['number'] <= 1000:
        ret['res'] = False
        ret['message'] = 'Number of UUIDs must be between 1 and 1000'
        return ret
Severity: Major
Found in salt/modules/random_org.py and 11 other locations - About 2 hrs to fix
salt/modules/random_org.py on lines 237..240
salt/modules/random_org.py on lines 242..245
salt/modules/random_org.py on lines 247..250
salt/modules/random_org.py on lines 352..355
salt/modules/random_org.py on lines 357..360
salt/modules/random_org.py on lines 528..531
salt/modules/random_org.py on lines 614..617
salt/modules/random_org.py on lines 619..622
salt/modules/random_org.py on lines 624..627
salt/modules/random_org.py on lines 629..632
salt/modules/random_org.py on lines 705..708

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

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

    if not _numeric(kwargs['number']) or not 1 <= kwargs['number'] <= 100:
        ret['res'] = False
        ret['message'] = 'Number of blobs must be between 1 and 100'
        return ret
Severity: Major
Found in salt/modules/random_org.py and 11 other locations - About 2 hrs to fix
salt/modules/random_org.py on lines 237..240
salt/modules/random_org.py on lines 242..245
salt/modules/random_org.py on lines 247..250
salt/modules/random_org.py on lines 352..355
salt/modules/random_org.py on lines 357..360
salt/modules/random_org.py on lines 444..447
salt/modules/random_org.py on lines 528..531
salt/modules/random_org.py on lines 614..617
salt/modules/random_org.py on lines 619..622
salt/modules/random_org.py on lines 624..627
salt/modules/random_org.py on lines 629..632

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

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

    if not _numeric(kwargs['number']) or not 1 <= kwargs['number'] <= 10000:
        ret['res'] = False
        ret['message'] = 'Number of integers must be between 1 and 10000'
        return ret
Severity: Major
Found in salt/modules/random_org.py and 11 other locations - About 2 hrs to fix
salt/modules/random_org.py on lines 242..245
salt/modules/random_org.py on lines 247..250
salt/modules/random_org.py on lines 352..355
salt/modules/random_org.py on lines 357..360
salt/modules/random_org.py on lines 444..447
salt/modules/random_org.py on lines 528..531
salt/modules/random_org.py on lines 614..617
salt/modules/random_org.py on lines 619..622
salt/modules/random_org.py on lines 624..627
salt/modules/random_org.py on lines 629..632
salt/modules/random_org.py on lines 705..708

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

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

    if not _numeric(kwargs['standardDeviation']) or not -1000000 <= kwargs['standardDeviation'] <= 1000000:
        ret['res'] = False
        ret['message'] = "The distribution's standard deviation must be between -1000000 and 1000000"
        return ret
Severity: Major
Found in salt/modules/random_org.py and 11 other locations - About 2 hrs to fix
salt/modules/random_org.py on lines 237..240
salt/modules/random_org.py on lines 242..245
salt/modules/random_org.py on lines 247..250
salt/modules/random_org.py on lines 352..355
salt/modules/random_org.py on lines 357..360
salt/modules/random_org.py on lines 444..447
salt/modules/random_org.py on lines 528..531
salt/modules/random_org.py on lines 614..617
salt/modules/random_org.py on lines 619..622
salt/modules/random_org.py on lines 629..632
salt/modules/random_org.py on lines 705..708

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

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

    if not _numeric(kwargs['significantDigits']) or not 2 <= kwargs['significantDigits'] <= 20:
        ret['res'] = False
        ret['message'] = 'The number of significant digits must be between 2 and 20'
        return ret
Severity: Major
Found in salt/modules/random_org.py and 11 other locations - About 2 hrs to fix
salt/modules/random_org.py on lines 237..240
salt/modules/random_org.py on lines 242..245
salt/modules/random_org.py on lines 247..250
salt/modules/random_org.py on lines 352..355
salt/modules/random_org.py on lines 357..360
salt/modules/random_org.py on lines 444..447
salt/modules/random_org.py on lines 528..531
salt/modules/random_org.py on lines 614..617
salt/modules/random_org.py on lines 619..622
salt/modules/random_org.py on lines 624..627
salt/modules/random_org.py on lines 705..708

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

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:
        result = __salt__['lxc.stop'](name, kill=kill, path=path)
    except (CommandExecutionError, SaltInvocationError) as exc:
        ret['result'] = False
        ret['comment'] = exc.strerror
Severity: Major
Found in salt/states/lxc.py and 2 other locations - About 2 hrs to fix
salt/states/lxc.py on lines 452..463
salt/states/lxc.py on lines 545..550

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

def show_instance(name, call=None):
    '''
    Show the details from SoftLayer concerning a guest
    '''
    if call != 'action':
Severity: Major
Found in salt/cloud/clouds/softlayer.py and 5 other locations - About 2 hrs to fix
salt/cloud/clouds/oneandone.py on lines 578..593
salt/cloud/clouds/profitbricks.py on lines 661..676
salt/cloud/clouds/proxmox.py on lines 1045..1056
salt/cloud/clouds/softlayer_hw.py on lines 488..499
salt/cloud/libcloudfuncs.py on lines 505..516

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

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:
        if state['old'] == 'frozen' and not restart:
            result = __salt__['lxc.unfreeze'](name, path=path)
        else:
            if restart:
Severity: Major
Found in salt/states/lxc.py and 2 other locations - About 2 hrs to fix
salt/states/lxc.py on lines 545..550
salt/states/lxc.py on lines 628..633

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

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:
        result = __salt__['lxc.freeze'](name, start=start, path=path)
    except (CommandExecutionError, SaltInvocationError) as exc:
        ret['result'] = False
        ret['comment'] = exc.strerror
Severity: Major
Found in salt/states/lxc.py and 2 other locations - About 2 hrs to fix
salt/states/lxc.py on lines 452..463
salt/states/lxc.py on lines 628..633

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

def show_instance(name, call=None):
    '''
    Show the details from the provider concerning an instance
    '''
    if call != 'action':
Severity: Major
Found in salt/cloud/clouds/profitbricks.py and 5 other locations - About 2 hrs to fix
salt/cloud/clouds/oneandone.py on lines 578..593
salt/cloud/clouds/proxmox.py on lines 1045..1056
salt/cloud/clouds/softlayer.py on lines 586..597
salt/cloud/clouds/softlayer_hw.py on lines 488..499
salt/cloud/libcloudfuncs.py on lines 505..516

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

def show_instance(name, call=None):
    '''
    Show the details from the provider concerning an instance
    '''
    if call != 'action':
Severity: Major
Found in salt/cloud/libcloudfuncs.py and 5 other locations - About 2 hrs to fix
salt/cloud/clouds/oneandone.py on lines 578..593
salt/cloud/clouds/profitbricks.py on lines 661..676
salt/cloud/clouds/proxmox.py on lines 1045..1056
salt/cloud/clouds/softlayer.py on lines 586..597
salt/cloud/clouds/softlayer_hw.py on lines 488..499

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

def show_instance(name, call=None):
    '''
    Show the details from the provider concerning an instance
    '''
    if call != 'action':
Severity: Major
Found in salt/cloud/clouds/oneandone.py and 5 other locations - About 2 hrs to fix
salt/cloud/clouds/profitbricks.py on lines 661..676
salt/cloud/clouds/proxmox.py on lines 1045..1056
salt/cloud/clouds/softlayer.py on lines 586..597
salt/cloud/clouds/softlayer_hw.py on lines 488..499
salt/cloud/libcloudfuncs.py on lines 505..516

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

def show_instance(name, call=None):
    '''
    Show the details from SoftLayer concerning a guest
    '''
    if call != 'action':
Severity: Major
Found in salt/cloud/clouds/softlayer_hw.py and 5 other locations - About 2 hrs to fix
salt/cloud/clouds/oneandone.py on lines 578..593
salt/cloud/clouds/profitbricks.py on lines 661..676
salt/cloud/clouds/proxmox.py on lines 1045..1056
salt/cloud/clouds/softlayer.py on lines 586..597
salt/cloud/libcloudfuncs.py on lines 505..516

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

def show_instance(name, call=None):
    '''
    Show the details from Proxmox concerning an instance
    '''
    if call != 'action':
Severity: Major
Found in salt/cloud/clouds/proxmox.py and 5 other locations - About 2 hrs to fix
salt/cloud/clouds/oneandone.py on lines 578..593
salt/cloud/clouds/profitbricks.py on lines 661..676
salt/cloud/clouds/softlayer.py on lines 586..597
salt/cloud/clouds/softlayer_hw.py on lines 488..499
salt/cloud/libcloudfuncs.py on lines 505..516

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

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

    try:
        container = __salt__['lxd.container_get'](
            name, remote_addr, cert, key, verify_cert, _raw=True
        )
    except CommandExecutionError as e:
Severity: Major
Found in salt/states/lxd_container.py and 4 other locations - About 2 hrs to fix
salt/states/lxd_container.py on lines 442..450
salt/states/lxd_container.py on lines 617..625
salt/states/lxd_container.py on lines 718..726
salt/states/lxd_image.py on lines 353..361

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

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