atlassian/themis

View on GitHub
themis/util/aws_common.py

Summary

Maintainability
B
4 hrs
Test Coverage

Function get_cluster_nodes has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

def get_cluster_nodes(cluster_id, role=None):
    emr_client = connect_emr(role=role)
    result = run_func(emr_client.list_instances, ClusterId=cluster_id,
                      InstanceStates=['AWAITING_FULFILLMENT', 'PROVISIONING', 'BOOTSTRAPPING', 'RUNNING'],
                      cache_duration_secs=QUERY_CACHE_TIMEOUT)
Severity: Minor
Found in themis/util/aws_common.py - About 3 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function terminate_inactive_nodes has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def terminate_inactive_nodes(cluster, cluster_state, role=None):
    if not is_presto_cluster(cluster):
        return
    nodes = cluster_state['nodes']
    for key, node in nodes.iteritems():
Severity: Minor
Found in themis/util/aws_common.py - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function get_instance_group_details has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def get_instance_group_details(cluster_id, group_id, role=None):
    groups = get_instance_groups(cluster_id, role=role)
    for key, arr in groups.iteritems():
        for val in arr:
            if val['id'] == group_id:
Severity: Minor
Found in themis/util/aws_common.py - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Error: invalid syntax (<unknown>, line 295)</unknown>
Open

            except Exception, e:
Severity: Minor
Found in themis/util/aws_common.py by radon

We encountered an error attempting to analyze this line.

TODO found
Open

# TODO move to model
Severity: Minor
Found in themis/util/aws_common.py by fixme

There are no issues that match your filters.

Category
Status