Showing 224 of 1,036 total issues
File docker_ssh.py
has 759 lines of code (exceeds 750 allowed). Consider refactoring. Open
import hashlib
import io
import json
import logging
import os
- Create a ticketCreate a ticket
Function deploy_heroku_docker
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def deploy_heroku_docker(log, verbose=True, app=None, exp_config=None):
from dallinger.docker.tools import build_image
config = get_config()
config.load()
- Create a ticketCreate a ticket
Function is_supported
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def is_supported(self, user_agent_string):
"""Check user agent against configured exclusions."""
user_agent_obj = user_agents.parse(user_agent_string)
browser_ok = True
for rule in self.exclusions:
- Read upRead up
- Create a ticketCreate a ticket
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 tileMatchesAvailable
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
GameManager.prototype.tileMatchesAvailable = function () {
var self = this;
var tile;
- Read upRead up
- Create a ticketCreate a ticket
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 vectors
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def vectors(self, direction="all", failed=False):
"""Get vectors that connect at this node.
Direction can be "incoming", "outgoing" or "all" (default).
Failed can be True, False or all
- Read upRead up
- Create a ticketCreate a ticket
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 serialized
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def serialized(func):
"""Run a function within a db transaction using SERIALIZABLE isolation.
With this isolation level, committing will fail if this transaction
read data that was since modified by another transaction. So we need
- Read upRead up
- Create a ticketCreate a ticket
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 _ensure_mturk_qualifications
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def _ensure_mturk_qualifications(self, qualifications):
"""Create MTurk Qualifications for names that don't already exist,
but also return names that already do.
"""
result = {"new_qualifications": [], "existing_qualifications": []}
- Read upRead up
- Create a ticketCreate a ticket
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 deploy
has 51 lines of code (exceeds 25 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()
- Create a ticketCreate a ticket
Consider simplifying this complex logical expression. Open
if (
(rule == "mobile" and user_agent_obj.is_mobile)
or (rule == "tablet" and user_agent_obj.is_tablet)
or (rule == "touchcapable" and user_agent_obj.is_touch_capable)
or (rule == "pc" and user_agent_obj.is_pc)
- Create a ticketCreate a ticket
Function published_study
has 16 arguments (exceeds 4 allowed). Consider refactoring. Open
def published_study(
- Create a ticketCreate a ticket
Function verify_config
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def verify_config(verbose=True):
"""Check for common or costly errors in experiment configuration."""
ok = True
config = get_config()
if not config.ready:
- Read upRead up
- Create a ticketCreate a ticket
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 table_data
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def table_data(
self, table: str = "participant", polymorphic_identity: Optional[str] = None
):
"""Generates DataTablesJS data and configuration for the experiment. The data
is compiled from the models' ``__json__`` methods, and can be customized by either
- Read upRead up
- Create a ticketCreate a ticket
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 site_config_dir
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def site_config_dir(appname=None, appauthor=None, version=None, multipath=False):
r"""Return full path to the user-shared data dir for this application.
"appname" is the name of application.
If None, just the system directory is returned.
- Read upRead up
- Create a ticketCreate a ticket
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 transmissions
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def transmissions(self, direction="outgoing", status="all", failed=False):
"""Get transmissions sent to or from this node.
Direction can be "all", "incoming" or "outgoing" (default).
Status can be "all" (default), "pending", or "received".
- Read upRead up
- Create a ticketCreate a ticket
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 wrap_subprocess_call
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def wrap_subprocess_call(func, wrap_stdout=True):
@functools.wraps(func)
def wrapper(*popenargs, **kwargs):
out = kwargs.get("stdout", None)
err = kwargs.get("stderr", None)
- Read upRead up
- Create a ticketCreate a ticket
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 connect
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def connect(self, whom, direction="to"):
"""Create a vector from self to/from whom.
Return a list of newly created vector between the node and whom.
``whom`` can be a specific node or a (nested) list of nodes. Nodes can
- Read upRead up
- Create a ticketCreate a ticket
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 createParticipant
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
dlgr.createParticipant = function() {
var url = "/participant";
var data = {};
var deferred = $.Deferred();
if (dlgr.identity.entryInformation) {
- Create a ticketCreate a ticket
Function deploy_image
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def deploy_image(image_name, mode, config_options):
"""Deploy Heroku app using a docker image and MTurk."""
config = get_config()
config.load()
dashboard_user = config.get("dashboard_user", "admin")
- Create a ticketCreate a ticket
Function move
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
GameManager.prototype.move = function (direction) {
// 0: up, 1: right, 2: down, 3: left
var self = this;
if (this.isGameTerminated()) return; // Don't do anything if the game's over
- Create a ticketCreate a ticket
Function draw
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
function draw() {
destroy();
var data = getnNetwork();
- Create a ticketCreate a ticket