Dallinger/Dallinger

View on GitHub

Showing 224 of 1,036 total issues

Function deploy has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

def deploy(
Severity: Major
Found in dallinger/command_line/docker_ssh.py - About 1 hr to fix

Function __call__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def __call__(self):
        gevent.sleep(0.200)

        try:
            logger.info(
Severity: Minor
Found in dallinger/experiment_server/replay.py - About 55 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 networks has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def networks(self, role="all", full="all"):
        """All the networks in the experiment."""
        if full not in ["all", True, False]:
            raise ValueError(
                "full must be boolean or all, it cannot be {}".format(full)
Severity: Minor
Found in dallinger/experiment.py - About 55 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 build_and_push_image has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def build_and_push_image(f):
    """Decorator for click commands that depend on a pushed docker image.

    Commands using this decorator can rely on the image being present in
    the remote registry, and thus can use it to deploy to a remote server.
Severity: Minor
Found in dallinger/command_line/docker_ssh.py - About 55 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 summary has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def summary():
    """Summarize the participants' status codes."""
    exp = Experiment(session)
    state = {
        "status": "success",
Severity: Minor
Found in dallinger/experiment_server/experiment_server.py - About 55 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 wait_for_text has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def wait_for_text(driver, el_id, value, removed=False, timeout=10):
    el = wait_for_element(driver, el_id, timeout)
    if value in el.text and not removed:
        return el
    if removed and value not in el.text:
Severity: Minor
Found in dallinger/pytest_dallinger.py - About 55 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 listen has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def listen(self):
        """Relay messages from a redis pubsub to all subscribed clients.

        This is run continuously in a separate greenlet.
        """
Severity: Minor
Found in dallinger/experiment_server/sockets.py - About 55 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 clear_workers has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def clear_workers():
    import subprocess

    def _zap():
        kills = [["pkill", "-f", "heroku"]]
Severity: Minor
Found in dallinger/pytest_dallinger.py - About 55 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 open_chatroom has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

var open_chatroom = function () {
  var ws_scheme = (window.location.protocol === "https:") ? 'wss://' : 'ws://';
  // Setup a websocket connection to the "chatroom", passing our worker_id and participant_id
  chatroom_socket = new ReconnectingWebSocket(
    ws_scheme + location.host + "/chat?channel=chatroom&worker_id=" + dallinger.identity.workerId + '&participant_id=' + dallinger.identity.participantId
Severity: Minor
Found in demos/dlgr/demos/chatroom_ws/static/scripts/experiment.js - About 55 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 receive has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def receive(self, what=None):
        """Receive some transmissions.

        Received transmissions are marked as received, then their infos are
        passed to update().
Severity: Minor
Found in dallinger/models.py - About 55 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_qualification_type_by_name has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def get_qualification_type_by_name(self, name):
        """Return a Qualification Type by name. If the provided name matches
        more than one Qualification, check to see if any of the results
        match the provided name exactly. If there's an exact match, return
        that Qualification. Otherwise, raise an exception.
Severity: Minor
Found in dallinger/mturk.py - About 55 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 register_extra_parameters has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def register_extra_parameters(self):
        initialize_experiment_package(os.getcwd())
        extra_parameters = None

        # Import and instantiate the experiment class if available
Severity: Minor
Found in dallinger/config.py - About 55 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 create_participant has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def create_participant(
Severity: Major
Found in dallinger/experiment.py - About 50 mins to fix

Function worker_function has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

def worker_function(
Severity: Major
Found in dallinger/experiment_server/worker_events.py - About 50 mins to fix

Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(self, output, verbose, bot, proxy_port, exp_config, no_browsers=False):
Severity: Major
Found in dallinger/deployment.py - About 50 mins to fix

Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(
Severity: Major
Found in dallinger/docker/tools.py - About 50 mins to fix

Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(
Severity: Major
Found in dallinger/heroku/tools.py - About 50 mins to fix

Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(
Severity: Major
Found in dallinger/models.py - About 50 mins to fix

Function user_config_dir has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def user_config_dir(appname=None, appauthor=None, version=None, roaming=False):
    r"""Return full path to the user-specific config dir for this application.

        "appname" is the name of application.
            If None, just the system directory is returned.
Severity: Minor
Found in dallinger/command_line/appdirs.py - About 45 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

Avoid deeply nested control flow statements.
Open

      if (this.dir !== "up") {
          this.newdir = "down";
          createInfo("Info", JSON.stringify({"move": "down"}));
      }
Severity: Major
Found in demos/dlgr/demos/snake/static/scripts/stake.js - About 45 mins to fix
Severity
Category
Status
Source
Language