atlassian/themis

View on GitHub

Showing 157 of 157 total issues

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.

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

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

We encountered an error attempting to analyze this line.

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

        except Exception, e:
Severity: Minor
Found in themis/monitoring/emr_monitoring.py by radon

We encountered an error attempting to analyze this line.

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

        print '%s%s' % (indent, self)
Severity: Minor
Found in themis/model/kinesis_model.py by radon

We encountered an error attempting to analyze this line.

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

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

We encountered an error attempting to analyze this line.

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

        except subprocess.CalledProcessError, e:
Severity: Minor
Found in themis/util/remote.py by radon

We encountered an error attempting to analyze this line.

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

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

We encountered an error attempting to analyze this line.

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

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

We encountered an error attempting to analyze this line.

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

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

We encountered an error attempting to analyze this line.

Function get_config has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def get_config(force_load=False, config_file_only=False):
    global last_config_load_time, CACHED_CONFIG
    if TEST_CONFIG:
        return TEST_CONFIG

Severity: Minor
Found in themis/config.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 run has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def run(cmd, cache_duration_secs=0, log_error=False, retries=0, sleep=2, backoff=1.4):
    def do_run(cmd):
        try:
            mutex_popen.acquire()
            # process = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
Severity: Minor
Found in themis/util/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 run_ssh has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def run_ssh(cmd, host, user=None, keys=None, via_hosts=[], cache_duration_secs=0):
    if not keys:
        keys = get_ssh_keys()

    user = '%s@' % user if user else ''
Severity: Minor
Found in themis/util/remote.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_node_load_part has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def get_node_load_part(cluster, host, type, monitoring_interval_secs=MONITORING_INTERVAL_SECS):
    ganglia_data = get_ganglia_datapoints(cluster, host, type, monitoring_interval_secs)
    if not ganglia_data:
        return float('NaN')
    curves_map = {}
Severity: Minor
Found in themis/monitoring/emr_monitoring.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_termination_candidates_for_market_or_group has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def get_termination_candidates_for_market_or_group(info, preferred, instance_group_type=INSTANCE_GROUP_TYPE_TASK):
    candidates = []
    cluster_id = info['cluster_id']
    LOG.debug('cluster_id={}'.format(json.dumps(cluster_id)))
    role = emr_monitoring.get_iam_role_for_cluster(cluster_id)
Severity: Minor
Found in themis/scaling/emr_scaling.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

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

                shard[metric]['last'] = series.values[-1] if len(series.values) > 0 else 0
Severity: Major
Found in themis/monitoring/kinesis_monitoring.py and 1 other location - About 1 hr to fix
themis/monitoring/kinesis_monitoring.py on lines 171..171

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

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

    def set(self, key, value):
        if isinstance(value, dict):
            value = KinesisStreamConfiguration.from_dict(value)
        return super(KinesisConfiguration, self).set(key, value)
Severity: Major
Found in themis/config.py and 1 other location - About 1 hr to fix
themis/config.py on lines 144..147

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

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

    def set(self, key, value):
        if isinstance(value, dict):
            value = EmrClusterConfiguration.from_dict(value)
        return super(EmrConfiguration, self).set(key, value)
Severity: Major
Found in themis/config.py and 1 other location - About 1 hr to fix
themis/config.py on lines 196..199

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

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

        total[metric]['last'] = series.values[-1] if len(series.values) > 0 else 0
Severity: Major
Found in themis/monitoring/kinesis_monitoring.py and 1 other location - About 1 hr to fix
themis/monitoring/kinesis_monitoring.py on lines 183..183

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

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

Function refresh has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    $scope.refresh = function() {
      $scope.state.loading = true;
      $scope.history.loading = true;
      $scope.savings.loading = true;
      client.then(function(client) {
Severity: Minor
Found in themis/web/views/emr.details.js - About 1 hr to fix

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

    def parallelize(array_or_dict, func):
        class MyThread (threading.Thread):
            def __init__(self, item, key=None):
                threading.Thread.__init__(self)
                self.item = item
    Severity: Minor
    Found in themis/util/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

    Severity
    Category
    Status
    Source
    Language