Dallinger/Dallinger

View on GitHub

Showing 224 of 1,036 total issues

Function login has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def login():
    next_url = request.form.get("next", request.args.get("next"))
    next_url = (
        next_url if next_url and is_safe_url(next_url) else url_for("dashboard.index")
    )
Severity: Minor
Found in dallinger/experiment_server/dashboard.py - About 35 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 export_db_uri has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def export_db_uri(id, db_uri, local, scrub_pii):
    # Create the data package if it doesn't already exist.
    subdata_path = os.path.join("data", id, "data")
    try:
        os.makedirs(subdata_path)
Severity: Minor
Found in dallinger/data.py - About 35 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 mousedownEventListener has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function mousedownEventListener(event) {
  if (clicked === false) {
    yNow = Math.round(stimulusYSize / PPU);

    // Training phase
Severity: Minor
Found in demos/dlgr/demos/function_learning/static/scripts/experiment.js - About 35 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 hits has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def hits(self, app=None, sandbox=False):
        """Lists all hits on a recruiter."""
        service = self.load_service(sandbox)
        hits = self._current_hits(service, app)
        formatted_hit_list = []
Severity: Minor
Found in dallinger/recruiters.py - About 35 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 _new_webbrowser_profile has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def _new_webbrowser_profile():
    if is_command("google-chrome"):
        return _make_chrome("google-chrome")
    elif is_command("firefox"):
        new_firefox = webbrowser.Mozilla()
Severity: Minor
Found in dallinger/utils.py - About 35 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 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def build(root):
    if not os.path.exists(os.path.join(root, "demos")):
        os.makedirs(os.path.join(root, "demos"))

    demos_dir = os.path.abspath(
Severity: Minor
Found in docs/source/build_demo_docs.py - About 35 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 fail has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def fail(self, reason=None):
        """Fail this object, and potentially its related objects.

        Set :attr:`~dallinger.models.SharedMixin.failed` to ``True`` and
        :attr:`~dallinger.models.SharedMixin.time_of_death` to now.
Severity: Minor
Found in dallinger/models.py - About 35 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 pg_wait has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def pg_wait(self):
        """Wait for the DB to be fired up."""
        retries = 10
        while retries:
            retries = retries - 1
Severity: Minor
Found in dallinger/heroku/tools.py - About 35 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 expunge_directory has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def expunge_directory(path_string):
    """Remove all content from a directory."""
    for filepath in Path(path_string).iterdir():
        try:
            if filepath.is_file() or filepath.is_symlink():
Severity: Minor
Found in dallinger/utils.py - About 35 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 as_dict has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def as_dict(self, include_sensitive=False):
        d = {}
        for key in self.types:
            if key not in self.sensitive or include_sensitive:
                try:
Severity: Minor
Found in dallinger/config.py - About 35 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 too many return statements within this function.
Open

            return error_response(
Severity: Major
Found in dallinger/experiment_server/experiment_server.py - About 30 mins to fix

Avoid too many return statements within this function.
Open

            return error_response(
Severity: Major
Found in dallinger/experiment_server/experiment_server.py - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return error_response(error_type=msg)
Severity: Major
Found in dallinger/experiment_server/experiment_server.py - About 30 mins to fix

Avoid too many return statements within this function.
Open

    return success_response()
Severity: Major
Found in dallinger/experiment_server/experiment_server.py - About 30 mins to fix

Avoid too many return statements within this function.
Open

    return success_response(recruitment_msg=message)
Severity: Major
Found in dallinger/experiment_server/experiment_server.py - About 30 mins to fix

Avoid too many return statements within this function.
Open

            return error_response(error_type=msg)
Severity: Major
Found in dallinger/experiment_server/experiment_server.py - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return error_response(
Severity: Major
Found in dallinger/experiment_server/experiment_server.py - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return error_response(error_type="/question POST server error", status=403)
Severity: Major
Found in dallinger/experiment_server/experiment_server.py - About 30 mins to fix

Avoid too many return statements within this function.
Open

    return success_response(transmissions=[t.__json__() for t in transmissions])
Severity: Major
Found in dallinger/experiment_server/experiment_server.py - About 30 mins to fix

Avoid too many return statements within this function.
Open

            return error_response(error_type=msg)
Severity: Major
Found in dallinger/experiment_server/experiment_server.py - About 30 mins to fix
Severity
Category
Status
Source
Language