saltstack/salt

View on GitHub

Showing 7,542 of 17,590 total issues

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

def get_address(address=None, vsys='1'):
    '''
    Get the candidate configuration for the specified get_address object. This will not return address objects that are
    marked as pre-defined objects.

Severity: Major
Found in salt/modules/panos.py and 4 other locations - About 1 hr to fix
salt/modules/panos.py on lines 349..371
salt/modules/panos.py on lines 1046..1067
salt/modules/panos.py on lines 1070..1092
salt/modules/panos.py on lines 1095..1117

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

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_service(service=None, vsys='1'):
    '''
    Get the candidate configuration for the specified service object. This will not return services that are marked
    as pre-defined objects.

Severity: Major
Found in salt/modules/panos.py and 4 other locations - About 1 hr to fix
salt/modules/panos.py on lines 324..346
salt/modules/panos.py on lines 349..371
salt/modules/panos.py on lines 1046..1067
salt/modules/panos.py on lines 1095..1117

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

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

    if path_style is None and __salt__['config.option']('s3.path_style') is not None:
        path_style = __salt__['config.option']('s3.path_style')
Severity: Major
Found in salt/modules/s3.py and 3 other locations - About 1 hr to fix
salt/modules/s3.py on lines 322..323
salt/modules/s3.py on lines 328..329
salt/modules/s3.py on lines 340..341

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

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

    if __opts__.get('__role') == 'master':
        fire_master = salt.utils.event.get_master_event(__opts__, __opts__['sock_dir']).fire_event
    else:
        fire_master = None
Severity: Major
Found in salt/engines/webhook.py and 3 other locations - About 1 hr to fix
salt/engines/docker_events.py on lines 70..75
salt/engines/ircbot.py on lines 157..160
salt/engines/slack.py on lines 314..319

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

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

        if __opts__.get('__role') == 'master':
            fire_master = salt.utils.event.get_master_event(
                __opts__,
                __opts__['sock_dir']).fire_master
        else:
Severity: Major
Found in salt/engines/slack.py and 3 other locations - About 1 hr to fix
salt/engines/docker_events.py on lines 70..75
salt/engines/ircbot.py on lines 157..160
salt/engines/webhook.py on lines 56..59

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

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

    if __opts__.get('__role') == 'master':
        fire_master = salt.utils.event.get_master_event(
            __opts__,
            __opts__['sock_dir']).fire_event
    else:
Severity: Major
Found in salt/engines/docker_events.py and 3 other locations - About 1 hr to fix
salt/engines/ircbot.py on lines 157..160
salt/engines/slack.py on lines 314..319
salt/engines/webhook.py on lines 56..59

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

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

    if location is None and __salt__['config.option']('s3.location') is not None:
        location = __salt__['config.option']('s3.location')
Severity: Major
Found in salt/modules/s3.py and 3 other locations - About 1 hr to fix
salt/modules/s3.py on lines 322..323
salt/modules/s3.py on lines 334..335
salt/modules/s3.py on lines 340..341

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

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

    if https_enable is None and __salt__['config.option']('s3.https_enable') is not None:
        https_enable = __salt__['config.option']('s3.https_enable')
Severity: Major
Found in salt/modules/s3.py and 3 other locations - About 1 hr to fix
salt/modules/s3.py on lines 322..323
salt/modules/s3.py on lines 328..329
salt/modules/s3.py on lines 334..335

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

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

        if __opts__.get('__role') == 'master':
            fire_master = salt.utils.event.get_master_event(__opts__, __opts__['sock_dir']).fire_event
        else:
            fire_master = None
Severity: Major
Found in salt/engines/ircbot.py and 3 other locations - About 1 hr to fix
salt/engines/docker_events.py on lines 70..75
salt/engines/slack.py on lines 314..319
salt/engines/webhook.py on lines 56..59

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

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

    if verify_ssl is None and __salt__['config.option']('s3.verify_ssl') is not None:
        verify_ssl = __salt__['config.option']('s3.verify_ssl')
Severity: Major
Found in salt/modules/s3.py and 3 other locations - About 1 hr to fix
salt/modules/s3.py on lines 328..329
salt/modules/s3.py on lines 334..335
salt/modules/s3.py on lines 340..341

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

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

CreateManagedType('vim.host.VsanStretchedClusterSystem', 'VimHostVsanStretchedClusterSystem', 'vmodl.ManagedObject', 'vim.version.version10', [], [('getStretchedClusterInfoFromCmmds', 'VSANHostGetStretchedClusterInfoFromCmmds', 'vim.version.version10', tuple(), (0 | F_OPTIONAL, 'vim.host.VSANStretchedClusterHostInfo[]', 'vim.host.VSANStretchedClusterHostInfo[]'), 'System.Read', None), ('witnessJoinVsanCluster', 'VSANWitnessJoinVsanCluster', 'vim.version.version10', (('clusterUuid', 'string', 'vim.version.version10', 0, None), ('preferredFd', 'string', 'vim.version.version10', 0, None), ('disableVsanAllowed', 'boolean', 'vim.version.version10', 0 | F_OPTIONAL, None), ), (0, 'void', 'void'), 'System.Read', None), ('witnessSetPreferredFaultDomain', 'VSANWitnessSetPreferredFaultDomain', 'vim.version.version10', (('preferredFd', 'string', 'vim.version.version10', 0, None), ), (0, 'void', 'void'), 'System.Read', None), ('addUnicastAgent', 'VSANHostAddUnicastAgent', 'vim.version.version10', (('witnessAddress', 'string', 'vim.version.version10', 0, None), ('witnessPort', 'int', 'vim.version.version10', 0 | F_OPTIONAL, None), ('overwrite', 'boolean', 'vim.version.version10', 0 | F_OPTIONAL, None), ), (0, 'void', 'void'), 'System.Read', None), ('clusterGetPreferredFaultDomain', 'VSANClusterGetPreferredFaultDomain', 'vim.version.version10', tuple(), (0 | F_OPTIONAL, 'vim.host.VSANCmmdsPreferredFaultDomainInfo', 'vim.host.VSANCmmdsPreferredFaultDomainInfo'), 'System.Read', None), ('witnessLeaveVsanCluster', 'VSANWitnessLeaveVsanCluster', 'vim.version.version10', tuple(), (0, 'void', 'void'), 'System.Read', None), ('getStretchedClusterCapability', 'VSANHostGetStretchedClusterCapability', 'vim.version.version10', tuple(), (0, 'vim.host.VSANStretchedClusterHostCapability', 'vim.host.VSANStretchedClusterHostCapability'), 'System.Read', None), ('removeUnicastAgent', 'VSANHostRemoveUnicastAgent', 'vim.version.version10', (('witnessAddress', 'string', 'vim.version.version10', 0, None), ('ignoreExistence', 'boolean', 'vim.version.version10', 0 | F_OPTIONAL, None), ), (0, 'void', 'void'), 'System.Read', None), ('listUnicastAgent', 'VSANHostListUnicastAgent', 'vim.version.version10', tuple(), (0, 'string', 'string'), 'System.Read', None), ])
Severity: Major
Found in salt/ext/vsan/vsanmgmtObjects.py and 2 other locations - About 1 hr to fix
salt/ext/vsan/vsanmgmtObjects.py on lines 8..8
salt/ext/vsan/vsanmgmtObjects.py on lines 14..14

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

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

CreateManagedType('vim.cluster.VsanVcStretchedClusterSystem', 'VimClusterVsanVcStretchedClusterSystem', 'vmodl.ManagedObject', 'vim.version.version10', [], [('isWitnessHost', 'VSANVcIsWitnessHost', 'vim.version.version10', (('host', 'vim.HostSystem', 'vim.version.version10', 0, None), ), (0, 'boolean', 'boolean'), 'System.Read', None), ('setPreferredFaultDomain', 'VSANVcSetPreferredFaultDomain', 'vim.version.version10', (('cluster', 'vim.ClusterComputeResource', 'vim.version.version10', 0, None), ('preferredFd', 'string', 'vim.version.version10', 0, None), ('witnessHost', 'vim.HostSystem', 'vim.version.version10', 0 | F_OPTIONAL, None), ), (0, 'vim.Task', 'vim.Task'), 'System.Read', None), ('getPreferredFaultDomain', 'VSANVcGetPreferredFaultDomain', 'vim.version.version10', (('cluster', 'vim.ClusterComputeResource', 'vim.version.version10', 0, None), ), (0 | F_OPTIONAL, 'vim.cluster.VSANPreferredFaultDomainInfo', 'vim.cluster.VSANPreferredFaultDomainInfo'), 'System.Read', None), ('getWitnessHosts', 'VSANVcGetWitnessHosts', 'vim.version.version10', (('cluster', 'vim.ClusterComputeResource', 'vim.version.version10', 0, None), ), (0 | F_OPTIONAL, 'vim.cluster.VSANWitnessHostInfo[]', 'vim.cluster.VSANWitnessHostInfo[]'), 'System.Read', None), ('retrieveStretchedClusterVcCapability', 'VSANVcRetrieveStretchedClusterVcCapability', 'vim.version.version10', (('cluster', 'vim.ClusterComputeResource', 'vim.version.version10', 0, None), ('verifyAllConnected', 'boolean', 'vim.version.version10', 0 | F_OPTIONAL, None), ), (0 | F_OPTIONAL, 'vim.cluster.VSANStretchedClusterCapability[]', 'vim.cluster.VSANStretchedClusterCapability[]'), 'System.Read', None), ('convertToStretchedCluster', 'VSANVcConvertToStretchedCluster', 'vim.version.version10', (('cluster', 'vim.ClusterComputeResource', 'vim.version.version10', 0, None), ('faultDomainConfig', 'vim.cluster.VSANStretchedClusterFaultDomainConfig', 'vim.version.version10', 0, None), ('witnessHost', 'vim.HostSystem', 'vim.version.version10', 0, None), ('preferredFd', 'string', 'vim.version.version10', 0, None), ('diskMapping', 'vim.vsan.host.DiskMapping', 'vim.version.version10', 0 | F_OPTIONAL, None), ), (0, 'vim.Task', 'vim.Task'), 'System.Read', None), ('removeWitnessHost', 'VSANVcRemoveWitnessHost', 'vim.version.version10', (('cluster', 'vim.ClusterComputeResource', 'vim.version.version10', 0, None), ('witnessHost', 'vim.HostSystem', 'vim.version.version10', 0 | F_OPTIONAL, None), ('witnessAddress', 'string', 'vim.version.version10', 0 | F_OPTIONAL, None), ), (0, 'vim.Task', 'vim.Task'), 'System.Read', None), ])
Severity: Major
Found in salt/ext/vsan/vsanmgmtObjects.py and 2 other locations - About 1 hr to fix
salt/ext/vsan/vsanmgmtObjects.py on lines 7..7
salt/ext/vsan/vsanmgmtObjects.py on lines 8..8

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

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

    if salt.utils.platform.is_windows():
        # On Windows, if the password contains a special character
        # such as '|', normal execution will fail. For example:
        # cmd: rabbitmq.add_user abc "asdf|def"
        # stderr: 'def' is not recognized as an internal or external
Severity: Major
Found in salt/modules/rabbitmq.py and 2 other locations - About 1 hr to fix
salt/modules/rabbitmq.py on lines 310..323
salt/modules/rabbitmq.py on lines 460..473

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

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

    if beacons:
        if return_yaml:
            tmp = {'beacons': beacons}
            return salt.utils.yaml.safe_dump(tmp, default_flow_style=False)
        else:
Severity: Major
Found in salt/modules/beacons.py and 2 other locations - About 1 hr to fix
salt/modules/beacons.py on lines 133..140
salt/modules/schedule.py on lines 152..159

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

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

        conn = psycopg2.connect(
            host=_options.get('host'),
            port=_options.get('port'),
            dbname=_options.get('db'),
            user=_options.get('user'),
Severity: Major
Found in salt/returners/pgjsonb.py and 2 other locations - About 1 hr to fix
salt/returners/postgres.py on lines 196..200
salt/states/slack.py on lines 137..142

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

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

    try:
        node_data = conn.create_node(**kwargs)
    except Exception as exc:  # pylint: disable=W0703
        log.error(
            'Error creating %s on GCE\n\n'
Severity: Major
Found in salt/cloud/clouds/gce.py and 2 other locations - About 1 hr to fix
salt/cloud/clouds/cloudstack.py on lines 375..386
salt/cloud/clouds/dimensiondata.py on lines 269..279

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

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

def get_account_created(name):
    '''
    Get the date/time the account was created

    :param str name: The username of the account
Severity: Major
Found in salt/modules/mac_shadow.py and 2 other locations - About 1 hr to fix
salt/modules/mac_shadow.py on lines 212..235
salt/modules/mac_shadow.py on lines 260..284

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

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

        conn = psycopg2.connect(host=_options.get('host'),
                                user=_options.get('user'),
                                password=_options.get('passwd'),
                                database=_options.get('db'),
                                port=_options.get('port'))
Severity: Major
Found in salt/returners/postgres.py and 2 other locations - About 1 hr to fix
salt/returners/pgjsonb.py on lines 251..256
salt/states/slack.py on lines 137..142

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

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

        if iqn is not None:
            try:
                array.set_host(name, addiqnlist=[iqn])
            except purestorage.PureError:
                array.delete_host(name)
Severity: Major
Found in salt/modules/purefa.py and 2 other locations - About 1 hr to fix
salt/modules/purefa.py on lines 653..658
salt/modules/purefa.py on lines 665..670

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

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

    try:
        data = conn.create_node(**kwargs)
    except Exception as exc:
        log.error(
            'Error creating %s on DIMENSIONDATA\n\n'
Severity: Major
Found in salt/cloud/clouds/dimensiondata.py and 2 other locations - About 1 hr to fix
salt/cloud/clouds/cloudstack.py on lines 375..386
salt/cloud/clouds/gce.py on lines 2560..2569

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

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