Dallinger/Dallinger

View on GitHub

Showing 224 of 1,036 total issues

Function add_node has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def add_node(self, node):
        """Add newcomers one by one, using linear preferential attachment."""
        nodes = self.nodes()

        # Start with a core of m0 fully-connected agents...
Severity: Minor
Found in dallinger/networks.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 draft_study has 14 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def draft_study(
Severity: Major
Found in dallinger/prolific.py - About 1 hr to fix

Function create_hit has 13 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def create_hit(
Severity: Major
Found in dallinger/mturk.py - About 1 hr to fix

Function regenerateDisplay has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function regenerateDisplay (state) {
  // Display parameters
  width = 600;
  height = 400;
  numDots = 80;
Severity: Minor
Found in demos/dlgr/demos/rogers/static/scripts/experiment.js - About 1 hr to fix

Function deploy_heroku_docker has a Cognitive Complexity of 13 (exceeds 5 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()
Severity: Minor
Found in dallinger/command_line/docker.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 pull_table has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def pull_table(
        self,
        table: Union[Table, str],
        polymorphic_identity: Optional[str] = None,
        network_roles: Optional[List] = None,
Severity: Minor
Found in dallinger/experiment.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 prepare_advertisement has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def prepare_advertisement():
    session = db.session
    config = _config()
    mode = config.get("mode")

Severity: Minor
Found in dallinger/experiment_server/experiment_server.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 _setupGame has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  Memory.prototype._setupGame = function() {
    var self = this;
    this.gameState = 1;
    this.cards = shuffle(this.options.cards);
    this.card1 = "";
Severity: Minor
Found in demos/dlgr/demos/concentration/static/scripts/memory.js - About 1 hr to fix

Function _all_topics has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def _all_topics(self):
        done = False
        next_token = None
        while not done:
            if next_token is not None:
Severity: Minor
Found in dallinger/mturk.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_hits has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def get_hits(self, hit_filter=lambda x: True):
        done = False
        next_token = None
        while not done:
            if next_token is not None:
Severity: Minor
Found in dallinger/mturk.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 _verify_startup has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def _verify_startup(self):
        for line in self._stream():
            self._record.append(line)
            if self.verbose:
                self.out.blather(line)
Severity: Minor
Found in dallinger/heroku/tools.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_workers_with_qualification has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def get_workers_with_qualification(self, qualification_id):
        """Get workers with the given qualification."""
        done = False
        next_token = None
        while not done:
Severity: Minor
Found in dallinger/mturk.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 neighbors has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def neighbors(self, type=None, direction="to", failed=None):
        """Get a node's neighbors - nodes that are directly connected to it.

        Type specifies the class of neighbour and must be a subclass of
        Node (default is Node).
Severity: Minor
Found in dallinger/models.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 BusyForm has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  dlgr.BusyForm = (function () {
    /* Loads a spinner as a visual cue that something is happening
       and disables any jQuery objects passed to freeze(). */

    var defaults = {
Severity: Minor
Found in dallinger/frontend/static/scripts/dallinger2.js - About 1 hr to fix

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

    def driver(self):
        """Returns a Selenium WebDriver instance of the type requested in the
        configuration."""
        from dallinger.config import get_config

Severity: Minor
Found in dallinger/bots.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 make_demo has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def make_demo(name, src, dst):
    print("Making '{}' demo...".format(name))

    static_files = []
    for file in os.listdir(src):
Severity: Minor
Found in docs/source/build_demo_docs.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 nodes has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def nodes(self, type=None, failed=False, participant_id=None):
        """Get nodes in the network.

        type specifies the type of Node. Failed can be "all", False
        (default) or True. If a participant_id is passed only
Severity: Minor
Found in dallinger/models.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 AjaxRejection has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  dlgr.AjaxRejection = (function () {
    // Capture information related to a rejected dallinger.ajax() call.

    var _responseHTML = function (response) {
      var parsed;
Severity: Minor
Found in dallinger/frontend/static/scripts/dallinger2.js - About 1 hr to fix

Function loadParticipant has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  dlgr.loadParticipant = function(assignment_info) {
    var data,
        deferred = $.Deferred(),
        url = '/load-participant';

Severity: Minor
Found in dallinger/frontend/static/scripts/dallinger2.js - About 1 hr to fix

Function handle_error has 29 lines of code (exceeds 25 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 1 hr to fix
Severity
Category
Status
Source
Language