saltstack/salt

View on GitHub

Showing 7,542 of 17,590 total issues

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

            if update_email_port:
                updated_email_port = __salt__['zabbix.mediatype_update'](mediatypeid,
                                                                         smtp_port=kwargs['smtp_port'],
                                                                         **connection_args)
                if 'error' in updated_email_port:
Severity: Major
Found in salt/states/zabbix_mediatype.py and 9 other locations - About 3 hrs to fix
salt/states/zabbix_mediatype.py on lines 198..205
salt/states/zabbix_mediatype.py on lines 207..214
salt/states/zabbix_mediatype.py on lines 216..223
salt/states/zabbix_mediatype.py on lines 247..254
salt/states/zabbix_mediatype.py on lines 290..297
salt/states/zabbix_usergroup.py on lines 126..133
salt/states/zabbix_usergroup.py on lines 135..142
salt/states/zabbix_usergroup.py on lines 144..151
salt/states/zabbix_usergroup.py on lines 153..160

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

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

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

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

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

Refactorings

Further Reading

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

    if network_interface_name:
        try:
            network_interface_id = get_network_interface_id(
                network_interface_name, region=region, key=key, keyid=keyid,
                profile=profile)
Severity: Major
Found in salt/modules/boto_ec2.py and 2 other locations - About 3 hrs to fix
salt/modules/boto_ec2.py on lines 371..382
salt/modules/boto_ec2.py on lines 465..476

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

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

            if update_gui_access:
                updated_gui = __salt__['zabbix.usergroup_update'](usrgrpid,
                                                                  gui_access=kwargs['gui_access'],
                                                                  **connection_args)
                if 'error' in updated_gui:
Severity: Major
Found in salt/states/zabbix_usergroup.py and 9 other locations - About 3 hrs to fix
salt/states/zabbix_mediatype.py on lines 189..196
salt/states/zabbix_mediatype.py on lines 198..205
salt/states/zabbix_mediatype.py on lines 207..214
salt/states/zabbix_mediatype.py on lines 216..223
salt/states/zabbix_mediatype.py on lines 247..254
salt/states/zabbix_mediatype.py on lines 290..297
salt/states/zabbix_usergroup.py on lines 126..133
salt/states/zabbix_usergroup.py on lines 144..151
salt/states/zabbix_usergroup.py on lines 153..160

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

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

            if update_email_verify_host:
                updated_email_verify_host = __salt__['zabbix.mediatype_update'](mediatypeid,
                                                                                smtp_verify_host=kwargs['smtp_verify_host'],
                                                                                **connection_args)
                if 'error' in updated_email_verify_host:
Severity: Major
Found in salt/states/zabbix_mediatype.py and 9 other locations - About 3 hrs to fix
salt/states/zabbix_mediatype.py on lines 189..196
salt/states/zabbix_mediatype.py on lines 198..205
salt/states/zabbix_mediatype.py on lines 207..214
salt/states/zabbix_mediatype.py on lines 247..254
salt/states/zabbix_mediatype.py on lines 290..297
salt/states/zabbix_usergroup.py on lines 126..133
salt/states/zabbix_usergroup.py on lines 135..142
salt/states/zabbix_usergroup.py on lines 144..151
salt/states/zabbix_usergroup.py on lines 153..160

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

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

            if update_script_params:
                updated_script_params = __salt__['zabbix.mediatype_update'](mediatypeid,
                                                                            exec_params=kwargs['exec_params'],
                                                                            **connection_args)
                if 'error' in updated_script_params:
Severity: Major
Found in salt/states/zabbix_mediatype.py and 9 other locations - About 3 hrs to fix
salt/states/zabbix_mediatype.py on lines 189..196
salt/states/zabbix_mediatype.py on lines 198..205
salt/states/zabbix_mediatype.py on lines 207..214
salt/states/zabbix_mediatype.py on lines 216..223
salt/states/zabbix_mediatype.py on lines 290..297
salt/states/zabbix_usergroup.py on lines 126..133
salt/states/zabbix_usergroup.py on lines 135..142
salt/states/zabbix_usergroup.py on lines 144..151
salt/states/zabbix_usergroup.py on lines 153..160

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

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

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

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

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

Refactorings

Further Reading

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

    if network_interface_name:
        try:
            network_interface_id = get_network_interface_id(
                network_interface_name, region=region, key=key, keyid=keyid,
                profile=profile)
Severity: Major
Found in salt/modules/boto_ec2.py and 2 other locations - About 3 hrs to fix
salt/modules/boto_ec2.py on lines 465..476
salt/modules/boto_ec2.py on lines 519..530

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

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

            if update_email_security:
                updated_email_security = __salt__['zabbix.mediatype_update'](mediatypeid,
                                                                             smtp_security=kwargs['smtp_security'],
                                                                             **connection_args)
                if 'error' in updated_email_security:
Severity: Major
Found in salt/states/zabbix_mediatype.py and 9 other locations - About 3 hrs to fix
salt/states/zabbix_mediatype.py on lines 189..196
salt/states/zabbix_mediatype.py on lines 207..214
salt/states/zabbix_mediatype.py on lines 216..223
salt/states/zabbix_mediatype.py on lines 247..254
salt/states/zabbix_mediatype.py on lines 290..297
salt/states/zabbix_usergroup.py on lines 126..133
salt/states/zabbix_usergroup.py on lines 135..142
salt/states/zabbix_usergroup.py on lines 144..151
salt/states/zabbix_usergroup.py on lines 153..160

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

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

            if update_status:
                updated_status = __salt__['zabbix.mediatype_update'](mediatypeid,
                                                                     status=kwargs['status'],
                                                                     **connection_args)
                if 'error' in updated_status:
Severity: Major
Found in salt/states/zabbix_mediatype.py and 9 other locations - About 3 hrs to fix
salt/states/zabbix_mediatype.py on lines 189..196
salt/states/zabbix_mediatype.py on lines 198..205
salt/states/zabbix_mediatype.py on lines 207..214
salt/states/zabbix_mediatype.py on lines 216..223
salt/states/zabbix_mediatype.py on lines 247..254
salt/states/zabbix_usergroup.py on lines 126..133
salt/states/zabbix_usergroup.py on lines 135..142
salt/states/zabbix_usergroup.py on lines 144..151
salt/states/zabbix_usergroup.py on lines 153..160

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

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 decrease_stream_retention_period(stream_name, retention_hours,
                                     region=None, key=None, keyid=None, profile=None):
    '''
    Decrease stream retention period to retention_hours

Severity: Major
Found in salt/modules/boto_kinesis.py and 4 other locations - About 3 hrs to fix
salt/modules/boto_kinesis.py on lines 177..192
salt/modules/boto_kinesis.py on lines 212..228
salt/modules/boto_kinesis.py on lines 250..267
salt/modules/boto_kinesis.py on lines 270..287

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

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 enable_enhanced_monitoring(stream_name, metrics,
                               region=None, key=None, keyid=None, profile=None):
    '''
    Enable enhanced monitoring for the specified shard-level metrics on stream stream_name

Severity: Major
Found in salt/modules/boto_kinesis.py and 4 other locations - About 3 hrs to fix
salt/modules/boto_kinesis.py on lines 177..192
salt/modules/boto_kinesis.py on lines 212..228
salt/modules/boto_kinesis.py on lines 231..247
salt/modules/boto_kinesis.py on lines 270..287

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

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 disable_enhanced_monitoring(stream_name, metrics,
                                region=None, key=None, keyid=None, profile=None):
    '''
    Disable enhanced monitoring for the specified shard-level metrics on stream stream_name

Severity: Major
Found in salt/modules/boto_kinesis.py and 4 other locations - About 3 hrs to fix
salt/modules/boto_kinesis.py on lines 177..192
salt/modules/boto_kinesis.py on lines 212..228
salt/modules/boto_kinesis.py on lines 231..247
salt/modules/boto_kinesis.py on lines 250..267

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

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 increase_stream_retention_period(stream_name, retention_hours,
                                     region=None, key=None, keyid=None, profile=None):
    '''
    Increase stream retention period to retention_hours

Severity: Major
Found in salt/modules/boto_kinesis.py and 4 other locations - About 3 hrs to fix
salt/modules/boto_kinesis.py on lines 177..192
salt/modules/boto_kinesis.py on lines 231..247
salt/modules/boto_kinesis.py on lines 250..267
salt/modules/boto_kinesis.py on lines 270..287

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

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 create_stream(stream_name, num_shards, region=None, key=None, keyid=None, profile=None):
    '''
    Create a stream with name stream_name and initial number of shards num_shards.

    CLI example::
Severity: Major
Found in salt/modules/boto_kinesis.py and 4 other locations - About 3 hrs to fix
salt/modules/boto_kinesis.py on lines 212..228
salt/modules/boto_kinesis.py on lines 231..247
salt/modules/boto_kinesis.py on lines 250..267
salt/modules/boto_kinesis.py on lines 270..287

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

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

    for pkgtype in pkgtypes:
        for member in group_pkgs.get(pkgtype, []):
            if member in pkgs:
                ret[pkgtype]['installed'].append(member)
            else:
Severity: Major
Found in salt/modules/pacmanpkg.py and 1 other location - About 3 hrs to fix
salt/modules/yumpkg.py on lines 2517..2522

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

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

    if self.connected and self.opts['pillar']:
        # The pillar has changed due to the connection to the master.
        # Reload the functions so that they can use the new pillar data.
        self.functions, self.returners, self.function_errors, self.executors = self._load_modules()
        if hasattr(self, 'schedule'):
Severity: Major
Found in salt/metaproxy/proxy.py and 1 other location - About 3 hrs to fix
salt/minion.py on lines 1286..1294

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

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

def _split_docker_uuid(uuid):
    '''
    Split a smartos docker uuid into repo and tag
    '''
    if uuid:
Severity: Major
Found in salt/modules/smartos_imgadm.py and 1 other location - About 3 hrs to fix
salt/states/smartos.py on lines 151..161

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

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

            if minion_instance.connected and minion_instance.opts['pillar'].get('minion_blackout', False):
                whitelist = minion_instance.opts['pillar'].get('minion_blackout_whitelist', [])
                # this minion is blacked out. Only allow saltutil.refresh_pillar and the whitelist
                if function_name != 'saltutil.refresh_pillar' and function_name not in whitelist:
                    minion_blackout_violation = True
Severity: Major
Found in salt/metaproxy/proxy.py and 1 other location - About 3 hrs to fix
salt/minion.py on lines 1675..1679

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

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

    if not disk_id:
        scsi_address_to_lun = \
                salt.utils.vmware.get_scsi_address_to_lun_map(host_ref)
        if scsi_address not in scsi_address_to_lun:
            raise VMwareObjectRetrievalError(
Severity: Major
Found in salt/modules/vsphere.py and 1 other location - About 3 hrs to fix
salt/modules/vsphere.py on lines 6101..6110

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

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 call['retcode'] != 0:
                comment = ''
                if 'stderr' in call:
                    comment += call['stderr']
                if 'stdout' in call:
Severity: Major
Found in salt/modules/mac_assistive.py and 3 other locations - About 3 hrs to fix
salt/modules/mac_assistive.py on lines 69..76
salt/modules/mac_assistive.py on lines 190..197
salt/modules/mac_assistive.py on lines 222..229

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

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

                if minion_instance.connected and minion_instance.opts['pillar'].get('minion_blackout', False):
                    whitelist = minion_instance.opts['pillar'].get('minion_blackout_whitelist', [])
                    # this minion is blacked out. Only allow saltutil.refresh_pillar and the whitelist
                    if function_name != 'saltutil.refresh_pillar' and function_name not in whitelist:
                        minion_blackout_violation = True
Severity: Major
Found in salt/minion.py and 1 other location - About 3 hrs to fix
salt/metaproxy/proxy.py on lines 370..374

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

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