saltstack/salt

View on GitHub

Showing 7,542 of 17,590 total issues

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

        if __opts__['test']:
            msg = 'Cache cluster {0} is set to be created.'.format(name)
            ret['comment'] = msg
            ret['result'] = None
            return ret
Severity: Major
Found in salt/states/boto_elasticache.py and 12 other locations - About 1 hr to fix
salt/states/boto_cloudtrail.py on lines 257..261
salt/states/boto_cloudwatch_alarm.py on lines 150..154
salt/states/boto_cloudwatch_alarm.py on lines 164..168
salt/states/boto_cloudwatch_event.py on lines 222..226
salt/states/boto_elasticsearch_domain.py on lines 308..312
salt/states/boto_iot.py on lines 378..382
salt/states/boto_sns.py on lines 117..121
salt/states/boto_vpc.py on lines 1005..1009
salt/states/boto_vpc.py on lines 1117..1121
salt/states/boto_vpc.py on lines 1200..1204
salt/states/pyrax_queues.py on lines 51..55
salt/states/telemetry_alert.py on lines 141..145

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

        if __opts__['test']:
            msg = 'CloudWatch event rule {0} set to be modified.'.format(Name)
            ret['comment'] = msg
            ret['result'] = None
            return ret
Severity: Major
Found in salt/states/boto_cloudwatch_event.py and 12 other locations - About 1 hr to fix
salt/states/boto_cloudtrail.py on lines 257..261
salt/states/boto_cloudwatch_alarm.py on lines 150..154
salt/states/boto_cloudwatch_alarm.py on lines 164..168
salt/states/boto_elasticache.py on lines 232..236
salt/states/boto_elasticsearch_domain.py on lines 308..312
salt/states/boto_iot.py on lines 378..382
salt/states/boto_sns.py on lines 117..121
salt/states/boto_vpc.py on lines 1005..1009
salt/states/boto_vpc.py on lines 1117..1121
salt/states/boto_vpc.py on lines 1200..1204
salt/states/pyrax_queues.py on lines 51..55
salt/states/telemetry_alert.py on lines 141..145

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

        if __opts__['test']:
            msg = 'CloudTrail {0} set to be modified.'.format(Name)
            ret['comment'] = msg
            ret['result'] = None
            return ret
Severity: Major
Found in salt/states/boto_cloudtrail.py and 12 other locations - About 1 hr to fix
salt/states/boto_cloudwatch_alarm.py on lines 150..154
salt/states/boto_cloudwatch_alarm.py on lines 164..168
salt/states/boto_cloudwatch_event.py on lines 222..226
salt/states/boto_elasticache.py on lines 232..236
salt/states/boto_elasticsearch_domain.py on lines 308..312
salt/states/boto_iot.py on lines 378..382
salt/states/boto_sns.py on lines 117..121
salt/states/boto_vpc.py on lines 1005..1009
salt/states/boto_vpc.py on lines 1117..1121
salt/states/boto_vpc.py on lines 1200..1204
salt/states/pyrax_queues.py on lines 51..55
salt/states/telemetry_alert.py on lines 141..145

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

        if __opts__['test']:
            msg = 'AWS SNS topic {0} is set to be created.'.format(name)
            ret['comment'] = msg
            ret['result'] = None
            return ret
Severity: Major
Found in salt/states/boto_sns.py and 12 other locations - About 1 hr to fix
salt/states/boto_cloudtrail.py on lines 257..261
salt/states/boto_cloudwatch_alarm.py on lines 150..154
salt/states/boto_cloudwatch_alarm.py on lines 164..168
salt/states/boto_cloudwatch_event.py on lines 222..226
salt/states/boto_elasticache.py on lines 232..236
salt/states/boto_elasticsearch_domain.py on lines 308..312
salt/states/boto_iot.py on lines 378..382
salt/states/boto_vpc.py on lines 1005..1009
salt/states/boto_vpc.py on lines 1117..1121
salt/states/boto_vpc.py on lines 1200..1204
salt/states/pyrax_queues.py on lines 51..55
salt/states/telemetry_alert.py on lines 141..145

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

def __virtual__():
    '''
    Only load if Win32 Libraries are installed
    '''
    if not salt.utils.platform.is_windows():
Severity: Major
Found in salt/utils/win_dacl.py and 6 other locations - About 1 hr to fix
salt/modules/win_lgpo.py on lines 4739..4747
salt/modules/win_service.py on lines 93..103
salt/modules/win_system.py on lines 50..60
salt/modules/win_useradd.py on lines 65..75
salt/utils/win_pdh.py on lines 60..70
salt/utils/win_reg.py on lines 60..73

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

def __virtual__():
    '''
    Only works on Windows Systems with Win32 Modules
    '''
    if not salt.utils.platform.is_windows():
Severity: Major
Found in salt/modules/win_system.py and 6 other locations - About 1 hr to fix
salt/modules/win_lgpo.py on lines 4739..4747
salt/modules/win_service.py on lines 93..103
salt/modules/win_useradd.py on lines 65..75
salt/utils/win_dacl.py on lines 157..167
salt/utils/win_pdh.py on lines 60..70
salt/utils/win_reg.py on lines 60..73

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

def __virtual__():
    '''
    Only works on Windows systems with PyWin32 installed
    '''
    if not salt.utils.platform.is_windows():
Severity: Major
Found in salt/modules/win_service.py and 6 other locations - About 1 hr to fix
salt/modules/win_lgpo.py on lines 4739..4747
salt/modules/win_system.py on lines 50..60
salt/modules/win_useradd.py on lines 65..75
salt/utils/win_dacl.py on lines 157..167
salt/utils/win_pdh.py on lines 60..70
salt/utils/win_reg.py on lines 60..73

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

def __virtual__():
    '''
    Only works on Windows systems
    '''
    if not salt.utils.platform.is_windows():
Severity: Major
Found in salt/modules/win_lgpo.py and 6 other locations - About 1 hr to fix
salt/modules/win_service.py on lines 93..103
salt/modules/win_system.py on lines 50..60
salt/modules/win_useradd.py on lines 65..75
salt/utils/win_dacl.py on lines 157..167
salt/utils/win_pdh.py on lines 60..70
salt/utils/win_reg.py on lines 60..73

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

def __virtual__():
    '''
    Requires Windows and Windows Modules
    '''
    if not salt.utils.platform.is_windows():
Severity: Major
Found in salt/modules/win_useradd.py and 6 other locations - About 1 hr to fix
salt/modules/win_lgpo.py on lines 4739..4747
salt/modules/win_service.py on lines 93..103
salt/modules/win_system.py on lines 50..60
salt/utils/win_dacl.py on lines 157..167
salt/utils/win_pdh.py on lines 60..70
salt/utils/win_reg.py on lines 60..73

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

def __virtual__():
    '''
    Only works on Windows systems with the PyWin32
    '''
    if not salt.utils.platform.is_windows():
Severity: Major
Found in salt/utils/win_reg.py and 6 other locations - About 1 hr to fix
salt/modules/win_lgpo.py on lines 4739..4747
salt/modules/win_service.py on lines 93..103
salt/modules/win_system.py on lines 50..60
salt/modules/win_useradd.py on lines 65..75
salt/utils/win_dacl.py on lines 157..167
salt/utils/win_pdh.py on lines 60..70

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

def __virtual__():
    '''
    Only works on Windows systems with the PyWin32
    '''
    if not salt.utils.platform.is_windows():
Severity: Major
Found in salt/utils/win_pdh.py and 6 other locations - About 1 hr to fix
salt/modules/win_lgpo.py on lines 4739..4747
salt/modules/win_service.py on lines 93..103
salt/modules/win_system.py on lines 50..60
salt/modules/win_useradd.py on lines 65..75
salt/utils/win_dacl.py on lines 157..167
salt/utils/win_reg.py on lines 60..73

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

    if data == 'removed':
        ret['comment'] = ("Cron env {0} removed from {1}'s crontab"
                          .format(name, user))
        ret['changes'] = {user: name}
        return ret
Severity: Major
Found in salt/states/cron.py and 5 other locations - About 1 hr to fix
salt/states/cron.py on lines 371..374
salt/states/cron.py on lines 440..444
salt/states/cron.py on lines 710..713
salt/states/incron.py on lines 153..156
salt/states/incron.py on lines 222..226

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

    if data == 'removed':
        ret['comment'] = ("Cron {0} removed from {1}'s crontab"
                          .format(name, user))
        ret['changes'] = {user: name}
        return ret
Severity: Major
Found in salt/states/cron.py and 5 other locations - About 1 hr to fix
salt/states/cron.py on lines 371..374
salt/states/cron.py on lines 710..713
salt/states/cron.py on lines 759..763
salt/states/incron.py on lines 153..156
salt/states/incron.py on lines 222..226

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

    if data == 'removed':
        ret['comment'] = ("Incron {0} removed from {1}'s crontab"
                          .format(name, user))
        ret['changes'] = {user: name}
        return ret
Severity: Major
Found in salt/states/incron.py and 5 other locations - About 1 hr to fix
salt/states/cron.py on lines 371..374
salt/states/cron.py on lines 440..444
salt/states/cron.py on lines 710..713
salt/states/cron.py on lines 759..763
salt/states/incron.py on lines 153..156

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

    if data == 'new':
        ret['comment'] = 'Cron {0} added to {1}\'s crontab'.format(name, user)
        ret['changes'] = {user: name}
        return ret
Severity: Major
Found in salt/states/cron.py and 5 other locations - About 1 hr to fix
salt/states/cron.py on lines 440..444
salt/states/cron.py on lines 710..713
salt/states/cron.py on lines 759..763
salt/states/incron.py on lines 153..156
salt/states/incron.py on lines 222..226

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

    if data == 'new':
        ret['comment'] = 'Cron env {0} added to {1}\'s crontab'.format(name, user)
        ret['changes'] = {user: name}
        return ret
Severity: Major
Found in salt/states/cron.py and 5 other locations - About 1 hr to fix
salt/states/cron.py on lines 371..374
salt/states/cron.py on lines 440..444
salt/states/cron.py on lines 759..763
salt/states/incron.py on lines 153..156
salt/states/incron.py on lines 222..226

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_address_group(addressgroup=None, vsys='1'):
    '''
    Get the candidate configuration for the specified address group. This will not return address groups 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 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 6 locations. Consider refactoring.
Open

    if data == 'new':
        ret['comment'] = 'Incron {0} added to {1}\'s incrontab'.format(name, user)
        ret['changes'] = {user: name}
        return ret
Severity: Major
Found in salt/states/incron.py and 5 other locations - About 1 hr to fix
salt/states/cron.py on lines 371..374
salt/states/cron.py on lines 440..444
salt/states/cron.py on lines 710..713
salt/states/cron.py on lines 759..763
salt/states/incron.py on lines 222..226

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_security_rule(rulename=None, vsys='1'):
    '''
    Get the candidate configuration for the specified security rule.

    rulename(str): The name of the security rule.
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 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_group(servicegroup=None, vsys='1'):
    '''
    Get the candidate configuration for the specified service group. This will not return service groups 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 1070..1092

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