saltstack/salt

View on GitHub

Showing 7,542 of 17,590 total issues

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

def delete_topic_rule(ruleName,
            region=None, key=None, keyid=None, profile=None):
    '''
    Given a rule name, delete it.

Severity: Major
Found in salt/modules/boto_iot.py and 7 other locations - About 4 hrs to fix
salt/modules/boto_apigateway.py on lines 504..520
salt/modules/boto_cloudtrail.py on lines 172..193
salt/modules/boto_cloudtrail.py on lines 345..366
salt/modules/boto_cloudtrail.py on lines 369..390
salt/modules/boto_cloudwatch_event.py on lines 156..177
salt/modules/boto_elasticsearch_domain.py on lines 267..287
salt/modules/boto_iot.py on lines 336..357

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

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

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

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

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

Refactorings

Further Reading

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

    try:
        conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
        targets = conn.list_targets_by_rule(Rule=Rule)
        ret = []
        if targets and 'Targets' in targets:
Severity: Major
Found in salt/modules/boto_cloudwatch_event.py and 3 other locations - About 4 hrs to fix
salt/modules/boto_cloudwatch_event.py on lines 195..210
salt/modules/boto_cloudwatch_event.py on lines 283..296
salt/modules/boto_cloudwatch_event.py on lines 313..326

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

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

def shutdown(name):
    '''
    Shut down Traffic Server on the local node.

    .. code-block:: yaml
Severity: Major
Found in salt/states/trafficserver.py and 8 other locations - About 4 hrs to fix
salt/states/trafficserver.py on lines 20..43
salt/states/trafficserver.py on lines 86..108
salt/states/trafficserver.py on lines 111..133
salt/states/trafficserver.py on lines 136..160
salt/states/trafficserver.py on lines 264..286
salt/states/trafficserver.py on lines 289..315
salt/states/trafficserver.py on lines 318..340
salt/states/trafficserver.py on lines 343..365

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

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

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

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

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

Refactorings

Further Reading

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

    try:
        conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
        rule = conn.describe_rule(Name=Name)
        if rule:
            keys = ('Name', 'Arn', 'EventPattern',
Severity: Major
Found in salt/modules/boto_cloudwatch_event.py and 3 other locations - About 4 hrs to fix
salt/modules/boto_cloudwatch_event.py on lines 250..266
salt/modules/boto_cloudwatch_event.py on lines 283..296
salt/modules/boto_cloudwatch_event.py on lines 313..326

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

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

def stop_logging(Name,
           region=None, key=None, keyid=None, profile=None):
    '''
    Stop logging for a trail

Severity: Major
Found in salt/modules/boto_cloudtrail.py and 7 other locations - About 4 hrs to fix
salt/modules/boto_apigateway.py on lines 504..520
salt/modules/boto_cloudtrail.py on lines 172..193
salt/modules/boto_cloudtrail.py on lines 345..366
salt/modules/boto_cloudwatch_event.py on lines 156..177
salt/modules/boto_elasticsearch_domain.py on lines 267..287
salt/modules/boto_iot.py on lines 336..357
salt/modules/boto_iot.py on lines 792..813

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

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

def clear_node(name):
    '''
    Clears accumulated statistics on the local node.

    .. code-block:: yaml
Severity: Major
Found in salt/states/trafficserver.py and 8 other locations - About 4 hrs to fix
salt/states/trafficserver.py on lines 20..43
salt/states/trafficserver.py on lines 86..108
salt/states/trafficserver.py on lines 136..160
salt/states/trafficserver.py on lines 239..261
salt/states/trafficserver.py on lines 264..286
salt/states/trafficserver.py on lines 289..315
salt/states/trafficserver.py on lines 318..340
salt/states/trafficserver.py on lines 343..365

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

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

def start_logging(Name,
           region=None, key=None, keyid=None, profile=None):
    '''
    Start logging for a trail

Severity: Major
Found in salt/modules/boto_cloudtrail.py and 7 other locations - About 4 hrs to fix
salt/modules/boto_apigateway.py on lines 504..520
salt/modules/boto_cloudtrail.py on lines 172..193
salt/modules/boto_cloudtrail.py on lines 369..390
salt/modules/boto_cloudwatch_event.py on lines 156..177
salt/modules/boto_elasticsearch_domain.py on lines 267..287
salt/modules/boto_iot.py on lines 336..357
salt/modules/boto_iot.py on lines 792..813

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

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

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

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

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

Refactorings

Further Reading

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

    try:
        conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
        if isinstance(Ids, six.string_types):
            Ids = salt.utils.json.loads(Ids)
        failures = conn.remove_targets(Rule=Rule, Ids=Ids)
Severity: Major
Found in salt/modules/boto_cloudwatch_event.py and 3 other locations - About 4 hrs to fix
salt/modules/boto_cloudwatch_event.py on lines 195..210
salt/modules/boto_cloudwatch_event.py on lines 250..266
salt/modules/boto_cloudwatch_event.py on lines 283..296

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

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

def restart_cluster(name):
    '''
    Restart the traffic_manager process and the traffic_server process on all
    the nodes in a cluster.

Severity: Major
Found in salt/states/trafficserver.py and 8 other locations - About 4 hrs to fix
salt/states/trafficserver.py on lines 20..43
salt/states/trafficserver.py on lines 86..108
salt/states/trafficserver.py on lines 111..133
salt/states/trafficserver.py on lines 239..261
salt/states/trafficserver.py on lines 264..286
salt/states/trafficserver.py on lines 289..315
salt/states/trafficserver.py on lines 318..340
salt/states/trafficserver.py on lines 343..365

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

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

def delete_policy(policyName,
            region=None, key=None, keyid=None, profile=None):
    '''
    Given a policy name, delete it.

Severity: Major
Found in salt/modules/boto_iot.py and 7 other locations - About 4 hrs to fix
salt/modules/boto_apigateway.py on lines 504..520
salt/modules/boto_cloudtrail.py on lines 172..193
salt/modules/boto_cloudtrail.py on lines 345..366
salt/modules/boto_cloudtrail.py on lines 369..390
salt/modules/boto_cloudwatch_event.py on lines 156..177
salt/modules/boto_elasticsearch_domain.py on lines 267..287
salt/modules/boto_iot.py on lines 792..813

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

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

def bounce_cluster(name):
    '''
    Bounce all Traffic Server nodes in the cluster. Bouncing Traffic Server
    shuts down and immediately restarts Traffic Server, node-by-node.

Severity: Major
Found in salt/states/trafficserver.py and 8 other locations - About 4 hrs to fix
salt/states/trafficserver.py on lines 86..108
salt/states/trafficserver.py on lines 111..133
salt/states/trafficserver.py on lines 136..160
salt/states/trafficserver.py on lines 239..261
salt/states/trafficserver.py on lines 264..286
salt/states/trafficserver.py on lines 289..315
salt/states/trafficserver.py on lines 318..340
salt/states/trafficserver.py on lines 343..365

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

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

def delete(Name,
            region=None, key=None, keyid=None, profile=None):
    '''
    Given a trail name, delete it.

Severity: Major
Found in salt/modules/boto_cloudtrail.py and 7 other locations - About 4 hrs to fix
salt/modules/boto_apigateway.py on lines 504..520
salt/modules/boto_cloudtrail.py on lines 345..366
salt/modules/boto_cloudtrail.py on lines 369..390
salt/modules/boto_cloudwatch_event.py on lines 156..177
salt/modules/boto_elasticsearch_domain.py on lines 267..287
salt/modules/boto_iot.py on lines 336..357
salt/modules/boto_iot.py on lines 792..813

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

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

def refresh(name):
    '''
    Initiate a Traffic Server configuration file reread. Use this command to
    update the running configuration after any configuration file modification.

Severity: Major
Found in salt/states/trafficserver.py and 8 other locations - About 4 hrs to fix
salt/states/trafficserver.py on lines 20..43
salt/states/trafficserver.py on lines 86..108
salt/states/trafficserver.py on lines 111..133
salt/states/trafficserver.py on lines 136..160
salt/states/trafficserver.py on lines 239..261
salt/states/trafficserver.py on lines 264..286
salt/states/trafficserver.py on lines 318..340
salt/states/trafficserver.py on lines 343..365

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

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

def delete_api_key(apiKey, region=None, key=None, keyid=None, profile=None):
    '''
    Deletes a given apiKey

    CLI Example:
Severity: Major
Found in salt/modules/boto_apigateway.py and 7 other locations - About 4 hrs to fix
salt/modules/boto_cloudtrail.py on lines 172..193
salt/modules/boto_cloudtrail.py on lines 345..366
salt/modules/boto_cloudtrail.py on lines 369..390
salt/modules/boto_cloudwatch_event.py on lines 156..177
salt/modules/boto_elasticsearch_domain.py on lines 267..287
salt/modules/boto_iot.py on lines 336..357
salt/modules/boto_iot.py on lines 792..813

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

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

def startup(name):
    '''
    Start Traffic Server on the local node.

    .. code-block:: yaml
Severity: Major
Found in salt/states/trafficserver.py and 8 other locations - About 4 hrs to fix
salt/states/trafficserver.py on lines 20..43
salt/states/trafficserver.py on lines 86..108
salt/states/trafficserver.py on lines 111..133
salt/states/trafficserver.py on lines 136..160
salt/states/trafficserver.py on lines 239..261
salt/states/trafficserver.py on lines 289..315
salt/states/trafficserver.py on lines 318..340
salt/states/trafficserver.py on lines 343..365

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

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

def delete(DomainName, region=None, key=None, keyid=None, profile=None):
    '''
    Given a domain name, delete it.

    Returns {deleted: true} if the domain was deleted and returns
Severity: Major
Found in salt/modules/boto_elasticsearch_domain.py and 7 other locations - About 4 hrs to fix
salt/modules/boto_apigateway.py on lines 504..520
salt/modules/boto_cloudtrail.py on lines 172..193
salt/modules/boto_cloudtrail.py on lines 345..366
salt/modules/boto_cloudtrail.py on lines 369..390
salt/modules/boto_cloudwatch_event.py on lines 156..177
salt/modules/boto_iot.py on lines 336..357
salt/modules/boto_iot.py on lines 792..813

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

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

def bulk_activate(workers, lbn, profile='default'):
    '''
    Activate all the given workers in the specific load balancer

    CLI Examples:
Severity: Major
Found in salt/modules/modjk.py and 3 other locations - About 4 hrs to fix
salt/modules/modjk.py on lines 302..328
salt/modules/modjk.py on lines 360..386
salt/modules/modjk.py on lines 389..415

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

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

            try:
                minion_blackout_violation = False
                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
Severity: Major
Found in salt/minion.py and 1 other location - About 4 hrs to fix
salt/metaproxy/proxy.py on lines 599..648

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

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 _check_time_range(time_range, now):
    '''
    Check time range
    '''
    if _TIME_SUPPORTED:
Severity: Major
Found in salt/beacons/btmp.py and 1 other location - About 4 hrs to fix
salt/beacons/wtmp.py on lines 212..223

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

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

def create_virtual(hostname, username, password, name, destination,
                   pool=None,
                   address_status=None,
                   auto_lasthop=None,
                   bwc_policy=None,
Severity: Major
Found in salt/states/bigip.py and 3 other locations - About 4 hrs to fix
salt/modules/bigip.py on lines 1237..1275
salt/states/bigip.py on lines 1851..1889
salt/states/bigip.py on lines 2172..2210

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

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