saltstack/salt

View on GitHub

Showing 7,542 of 17,590 total issues

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

def network_create(auth=None, **kwargs):
    '''
    Create a network

    name
Severity: Major
Found in salt/modules/neutronng.py and 9 other locations - About 40 mins to fix
salt/modules/glanceng.py on lines 108..121
salt/modules/keystoneng.py on lines 131..144
salt/modules/keystoneng.py on lines 232..246
salt/modules/keystoneng.py on lines 334..346
salt/modules/keystoneng.py on lines 430..443
salt/modules/keystoneng.py on lines 530..544
salt/modules/keystoneng.py on lines 631..645
salt/modules/keystoneng.py on lines 726..739
salt/modules/neutronng.py on lines 392..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 42.

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

def endpoint_create(auth=None, **kwargs):
    '''
    Create an endpoint

    CLI Example:
Severity: Major
Found in salt/modules/keystoneng.py and 9 other locations - About 40 mins to fix
salt/modules/glanceng.py on lines 108..121
salt/modules/keystoneng.py on lines 131..144
salt/modules/keystoneng.py on lines 232..246
salt/modules/keystoneng.py on lines 334..346
salt/modules/keystoneng.py on lines 430..443
salt/modules/keystoneng.py on lines 530..544
salt/modules/keystoneng.py on lines 726..739
salt/modules/neutronng.py on lines 109..147
salt/modules/neutronng.py on lines 392..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 42.

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

def security_group_create(auth=None, **kwargs):
    '''
    Create a security group. Use security_group_get to create default.

    project_id
Severity: Major
Found in salt/modules/neutronng.py and 9 other locations - About 40 mins to fix
salt/modules/glanceng.py on lines 108..121
salt/modules/keystoneng.py on lines 131..144
salt/modules/keystoneng.py on lines 232..246
salt/modules/keystoneng.py on lines 334..346
salt/modules/keystoneng.py on lines 430..443
salt/modules/keystoneng.py on lines 530..544
salt/modules/keystoneng.py on lines 631..645
salt/modules/keystoneng.py on lines 726..739
salt/modules/neutronng.py on lines 109..147

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

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

def user_create(auth=None, **kwargs):
    '''
    Create a user

    CLI Example:
Severity: Major
Found in salt/modules/keystoneng.py and 9 other locations - About 40 mins to fix
salt/modules/glanceng.py on lines 108..121
salt/modules/keystoneng.py on lines 131..144
salt/modules/keystoneng.py on lines 232..246
salt/modules/keystoneng.py on lines 334..346
salt/modules/keystoneng.py on lines 430..443
salt/modules/keystoneng.py on lines 631..645
salt/modules/keystoneng.py on lines 726..739
salt/modules/neutronng.py on lines 109..147
salt/modules/neutronng.py on lines 392..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 42.

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 not m_pub_exists:
                    # the minion has not received any masters pubkey yet, write
                    # the newly received pubkey to minion_master.pub
                    with salt.utils.files.fopen(m_pub_fn, 'wb+') as fp_:
                        fp_.write(salt.utils.stringutils.to_bytes(payload['pub_key']))
Severity: Major
Found in salt/crypt.py and 5 other locations - About 40 mins to fix
salt/daemons/masterapi.py on lines 982..983
salt/fileserver/azurefs.py on lines 293..294
salt/runners/digicertapi.py on lines 583..584
salt/runners/venafiapi.py on lines 209..210
salt/wheel/key.py on lines 419..420

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

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

        with salt.utils.files.fopen(hashdest, 'w+') as fp_:
            fp_.write(salt.utils.stringutils.to_str(ret['hsum']))
Severity: Major
Found in salt/fileserver/azurefs.py and 5 other locations - About 40 mins to fix
salt/crypt.py on lines 1119..1123
salt/daemons/masterapi.py on lines 982..983
salt/runners/digicertapi.py on lines 583..584
salt/runners/venafiapi.py on lines 209..210
salt/wheel/key.py on lines 419..420

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

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

    with salt.utils.files.fopen(tmppriv, 'w') as if_:
        if_.write(salt.utils.stringutils.to_str(data['private_key']))
Severity: Major
Found in salt/runners/venafiapi.py and 5 other locations - About 40 mins to fix
salt/crypt.py on lines 1119..1123
salt/daemons/masterapi.py on lines 982..983
salt/fileserver/azurefs.py on lines 293..294
salt/runners/digicertapi.py on lines 583..584
salt/wheel/key.py on lines 419..420

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

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

    with salt.utils.files.fopen(tmppriv, 'w') as if_:
        if_.write(salt.utils.stringutils.to_str(data['private_key']))
Severity: Major
Found in salt/runners/digicertapi.py and 5 other locations - About 40 mins to fix
salt/crypt.py on lines 1119..1123
salt/daemons/masterapi.py on lines 982..983
salt/fileserver/azurefs.py on lines 293..294
salt/runners/venafiapi.py on lines 209..210
salt/wheel/key.py on lines 419..420

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

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

        with salt.utils.files.fopen(jid_fn, 'w+') as fp_:
            fp_.write(salt.utils.stringutils.to_str(load['id']))
Severity: Major
Found in salt/daemons/masterapi.py and 5 other locations - About 40 mins to fix
salt/crypt.py on lines 1119..1123
salt/fileserver/azurefs.py on lines 293..294
salt/runners/digicertapi.py on lines 583..584
salt/runners/venafiapi.py on lines 209..210
salt/wheel/key.py on lines 419..420

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

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

    with salt.utils.files.fopen(acc_path, 'w+') as fp_:
        fp_.write(salt.utils.stringutils.to_str(ret['pub']))
Severity: Major
Found in salt/wheel/key.py and 5 other locations - About 40 mins to fix
salt/crypt.py on lines 1119..1123
salt/daemons/masterapi.py on lines 982..983
salt/fileserver/azurefs.py on lines 293..294
salt/runners/digicertapi.py on lines 583..584
salt/runners/venafiapi.py on lines 209..210

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

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

@proxy_napalm_wrap
def set_users(users, test=False, commit=True, **kwargs):  # pylint: disable=unused-argument

    '''
    Configures users on network devices.
Severity: Major
Found in salt/modules/napalm_users.py and 4 other locations - About 40 mins to fix
salt/modules/napalm_probes.py on lines 179..265
salt/modules/napalm_probes.py on lines 272..316
salt/modules/napalm_probes.py on lines 323..368
salt/modules/napalm_users.py on lines 144..174

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

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

    normalize = lambda x: six.text_type(x).split(':', 1)[-1] \
                if ignore_epoch else six.text_type(x)
Severity: Major
Found in salt/modules/aptpkg.py and 4 other locations - About 40 mins to fix
salt/modules/opkg.py on lines 1215..1215
salt/modules/rpm_lowpkg.py on lines 696..698
salt/states/pip_state.py on lines 306..306
salt/utils/versions.py on lines 243..244

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

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

    normalize = lambda x: six.text_type(x).split(':', 1)[-1] \
        if ignore_epoch \
        else six.text_type(x)
Severity: Major
Found in salt/modules/rpm_lowpkg.py and 4 other locations - About 40 mins to fix
salt/modules/aptpkg.py on lines 1425..1426
salt/modules/opkg.py on lines 1215..1215
salt/states/pip_state.py on lines 306..306
salt/utils/versions.py on lines 243..244

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

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

def get_graphics(vm_, **kwargs):
    '''
    Returns the information on vnc for a given vm

    :param vm_: name of the domain
Severity: Major
Found in salt/modules/virt.py and 4 other locations - About 40 mins to fix
salt/modules/virt.py on lines 2288..2312
salt/modules/virt.py on lines 2315..2340
salt/modules/virt.py on lines 2370..2390
salt/modules/virt.py on lines 2393..2417

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

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

@proxy_napalm_wrap
def set_probes(probes, test=False, commit=True, **kwargs):  # pylint: disable=unused-argument
    '''
    Configures RPM/SLA probes on the device.
    Calls the configuration template 'set_probes' from the NAPALM library,
Severity: Major
Found in salt/modules/napalm_probes.py and 4 other locations - About 40 mins to fix
salt/modules/napalm_probes.py on lines 272..316
salt/modules/napalm_probes.py on lines 323..368
salt/modules/napalm_users.py on lines 101..137
salt/modules/napalm_users.py on lines 144..174

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

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

    normalize = lambda x: six.text_type(x).split('!', 1)[-1] if ignore_epoch else six.text_type(x)
Severity: Major
Found in salt/states/pip_state.py and 4 other locations - About 40 mins to fix
salt/modules/aptpkg.py on lines 1425..1426
salt/modules/opkg.py on lines 1215..1215
salt/modules/rpm_lowpkg.py on lines 696..698
salt/utils/versions.py on lines 243..244

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

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

@proxy_napalm_wrap
def delete_users(users, test=False, commit=True, **kwargs):  # pylint: disable=unused-argument

    '''
    Removes users from the configuration of network devices.
Severity: Major
Found in salt/modules/napalm_users.py and 4 other locations - About 40 mins to fix
salt/modules/napalm_probes.py on lines 179..265
salt/modules/napalm_probes.py on lines 272..316
salt/modules/napalm_probes.py on lines 323..368
salt/modules/napalm_users.py on lines 101..137

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

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

@proxy_napalm_wrap
def delete_probes(probes, test=False, commit=True, **kwargs):  # pylint: disable=unused-argument

    '''
    Removes RPM/SLA probes from the network device.
Severity: Major
Found in salt/modules/napalm_probes.py and 4 other locations - About 40 mins to fix
salt/modules/napalm_probes.py on lines 179..265
salt/modules/napalm_probes.py on lines 323..368
salt/modules/napalm_users.py on lines 101..137
salt/modules/napalm_users.py on lines 144..174

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

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

def get_loader(vm_, **kwargs):
    '''
    Returns the information on the loader for a given vm

    :param vm_: name of the domain
Severity: Major
Found in salt/modules/virt.py and 4 other locations - About 40 mins to fix
salt/modules/virt.py on lines 2288..2312
salt/modules/virt.py on lines 2315..2340
salt/modules/virt.py on lines 2343..2367
salt/modules/virt.py on lines 2393..2417

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

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

    normalize = lambda x: six.text_type(x).split(':', 1)[-1] if ignore_epoch else six.text_type(x)
Severity: Major
Found in salt/modules/opkg.py and 4 other locations - About 40 mins to fix
salt/modules/aptpkg.py on lines 1425..1426
salt/modules/rpm_lowpkg.py on lines 696..698
salt/states/pip_state.py on lines 306..306
salt/utils/versions.py on lines 243..244

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

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