Dallinger/Dallinger

View on GitHub

Showing 224 of 1,035 total issues

Function draw_network has a Cognitive Complexity of 136 (exceeds 5 allowed). Consider refactoring.
Open

var draw_network = function () {
    var template_globals = templateGlobals();
    var network = null;
    var net_structure = template_globals.network_structure || {}; // this  is a container for all the data coming from the route
    var vis_options = template_globals.vis_options || {}; // This is a set of overrides for the vis options
Severity: Minor
Found in dallinger/frontend/static/scripts/network-monitor.js - About 2 days 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 draw_network has 525 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var draw_network = function () {
    var template_globals = templateGlobals();
    var network = null;
    var net_structure = template_globals.network_structure || {}; // this  is a container for all the data coming from the route
    var vis_options = template_globals.vis_options || {}; // This is a set of overrides for the vis options
Severity: Major
Found in dallinger/frontend/static/scripts/network-monitor.js - About 2 days to fix

File experiment.py has 1462 lines of code (exceeds 750 allowed). Consider refactoring.
Open

"""The base experiment class."""

from __future__ import print_function, unicode_literals

import datetime
Severity: Major
Found in dallinger/experiment.py - About 2 days to fix

File models.py has 1412 lines of code (exceeds 750 allowed). Consider refactoring.
Open

"""Define Dallinger's core models."""

import inspect
from datetime import datetime

Severity: Major
Found in dallinger/models.py - About 2 days to fix

Function dallinger has 435 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var dallinger = (function () {
  /**
   * @namespace
   * @alias dallinger
   */
Severity: Major
Found in dallinger/frontend/static/scripts/dallinger2.js - About 2 days to fix

File recruiters.py has 1384 lines of code (exceeds 750 allowed). Consider refactoring.
Open

"""Recruiters manage the flow of participants to the experiment."""

from __future__ import unicode_literals

import json
Severity: Major
Found in dallinger/recruiters.py - About 2 days to fix

File experiment_server.py has 1382 lines of code (exceeds 750 allowed). Consider refactoring.
Open

""" This module provides the backend Flask server that serves an experiment. """

import os
import re
from datetime import datetime
Severity: Major
Found in dallinger/experiment_server/experiment_server.py - About 2 days to fix

Experiment has 85 functions (exceeds 20 allowed). Consider refactoring.
Open

class Experiment(object):
    """Define the structure of an experiment."""

    app_id = None
    exp_config = None
Severity: Major
Found in dallinger/experiment.py - About 1 day to fix

Function dallinger has a Cognitive Complexity of 79 (exceeds 5 allowed). Consider refactoring.
Open

var dallinger = (function () {
  /**
   * @namespace
   * @alias dallinger
   */
Severity: Minor
Found in dallinger/frontend/static/scripts/dallinger2.js - About 1 day 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 getnNetwork has 306 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function getnNetwork() {
        var i, j, from, to, roles, net, networks_roles, my_role, mclr,
            is_found, roles_colors, clr, rr, gg, bb, count_nodes,
            participant, participant_id, node, msg, mgroup, vector,
            info, my_node_id, tran, group_fathers, gtitle, min_id,
Severity: Major
Found in dallinger/frontend/static/scripts/network-monitor.js - About 1 day to fix

Function deploy has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

def deploy(
    image_name, mode, server, dns_host, app_name, config_options, archive_path, update
):  # pragma: no cover
    """Deploy a dallinger experiment docker image to a server using ssh."""
    config = get_config()
Severity: Minor
Found in dallinger/command_line/docker_ssh.py - About 6 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 handle_error has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

def handle_error():
    request_data = request.form.get("request_data")
    error_feedback = request.form.get("error_feedback")
    error_type = request.form.get("error_type")
    error_text = request.form.get("error_text")
Severity: Minor
Found in dallinger/experiment_server/experiment_server.py - About 5 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

MTurkService has 38 functions (exceeds 20 allowed). Consider refactoring.
Open

class MTurkService(object):
    """Facade for Amazon Mechanical Turk services provided via the boto3
    library.
    """

Severity: Minor
Found in dallinger/mturk.py - About 5 hrs to fix

Function init has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

ScribeDallingerTracker.prototype.init = function() {
  var config = this.config;
  var getNodeDescriptor = function(node) {
    return {
      id:         node.id,
Severity: Minor
Found in dallinger/frontend/static/scripts/tracking/scribe-dallinger.js - About 4 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 worker_function has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

def worker_function(
    event_type,
    assignment_id,
    participant_id,
    node_id=None,
Severity: Minor
Found in dallinger/experiment_server/worker_events.py - About 4 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 getOptions has 105 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function getOptions() {
        var options = {
            layout: {
                improvedLayout: false,
                hierarchical: {
Severity: Major
Found in dallinger/frontend/static/scripts/network-monitor.js - About 4 hrs to fix

Function receive_message has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    def receive_message(
        self, message, channel_name=None, participant=None, node=None, receive_time=None
    ):
        """We recieve all messages coming into the ``chatroom`` channel along with
        the ``dallinger_control`` channel. We store all user messages as
Severity: Minor
Found in demos/dlgr/demos/chatroom_ws/experiment.py - About 4 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

HerokuApp has 31 functions (exceeds 20 allowed). Consider refactoring.
Open

class HerokuApp(HerokuCommandRunner):
    """Representation of a Heroku app"""

    def __init__(self, dallinger_uid, output=None, team=None):
        self.dallinger_uid = dallinger_uid
Severity: Minor
Found in dallinger/heroku/tools.py - About 3 hrs to fix

Function extend has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    def extend(self, mapping, cast_types=False, strict=False):
        normalized_mapping = {}
        for key, value in mapping.items():
            key = self.synonyms.get(key, key)
            test_deprecation(key)
Severity: Minor
Found in dallinger/config.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 prep_datatables_options has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

def prep_datatables_options(table_data):
    """Attempts to generate a reasonable a DataTables config"""
    datatables_options = deepcopy(TABLE_DEFAULTS)
    datatables_options.update(deepcopy(table_data))
    # Display objects and arrays in useful ways
Severity: Minor
Found in dallinger/experiment_server/dashboard.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

Severity
Category
Status
Source
Language