atlassian/themis

View on GitHub

Showing 68 of 157 total issues

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

def array_reverse(array):
    result = []
    for i, item1 in enumerate(array):
        for j, item2 in enumerate(item1):
            if len(result) <= j:
Severity: Minor
Found in themis/util/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

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

def get_kinesis_cloudwatch_metrics(stream, metric, shard=None):
    dimensions = [{'Name': 'StreamName', 'Value': stream.id}]
    if shard:
        shard = shard if isinstance(shard, basestring) else shard['id'] if isinstance(shard, dict) else shard.id
        dimensions.append({'Name': 'ShardId', 'Value': shard})
Severity: Minor
Found in themis/monitoring/kinesis_monitoring.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

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

def get_stats(values):
    sum = 0
    min = float("inf")
    max = 0
    for num in values:
Severity: Minor
Found in themis/util/math_util.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

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

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

def get_node_groups_or_preferred_markets(cluster_id, info=None, config=None):
    if not config:
        config = themis.config.get_config()
    cluster_config = config.get(SECTION_EMR, cluster_id)
    preferred = cluster_config.group_or_preferred_market
Severity: Minor
Found in themis/scaling/emr_scaling.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

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

def load_fixed_prices(zone):
    zone = get_short_zone(zone)
    url = "https://pricing.%s.amazonaws.com/offers/v1.0/aws/AmazonEC2/current/index.json" % zone
    file = "/tmp/aws_fixed_%s.json" % zone
    result = None
Severity: Minor
Found in themis/util/aws_pricing.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

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

def init_resources_file(run_parallel=False):
    if os.path.isfile(RESOURCES_FILE_LOCATION):
        return

    sys_config = get_config()
Severity: Minor
Found in themis/monitoring/resources.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

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

def restart_emr_node():
    """ Restart a cluster node
        ---
        operationId: 'restartEmrNode'
        parameters:
Severity: Minor
Found in themis/api.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

Severity
Category
Status
Source
Language