atlassian/themis

View on GitHub
themis/scaling/kinesis_scaling.py

Summary

Maintainability
A
1 hr
Test Coverage

Function get_downscale_shards has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def get_downscale_shards(stream, config=None):
    if not config:
        config = themis.config.get_config()
    expr = config.get(SECTION_KINESIS, stream.id, KEY_STREAM_DOWNSCALE_EXPR)
    num_downsize = execute_dsl_string(expr, stream.monitoring_data, config=config)
Severity: Minor
Found in themis/scaling/kinesis_scaling.py - About 35 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 perform_scaling has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def perform_scaling(kinesis_stream):
    downscale = get_downscale_shards(kinesis_stream)
    upscale = get_upscale_shards(kinesis_stream)
    action = 'NOTHING'
    role = kinesis_monitoring.get_iam_role_for_stream(kinesis_stream)
Severity: Minor
Found in themis/scaling/kinesis_scaling.py - About 35 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 110)</unknown>
Open

    except Exception, e:
Severity: Minor
Found in themis/scaling/kinesis_scaling.py by radon

We encountered an error attempting to analyze this line.

TODO found
Open

        # TODO check if adjacent
Severity: Minor
Found in themis/scaling/kinesis_scaling.py by fixme

There are no issues that match your filters.

Category
Status