Cloud-CV/EvalAI

View on GitHub
scripts/seed.py

Summary

Maintainability
D
1 day
Test Coverage

File seed.py has 514 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Command to run : python manage.py shell  < scripts/seed.py
import datetime
import json
import os
import random
Severity: Major
Found in scripts/seed.py - About 1 day to fix

    Function run has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    def run(*args):
        try:
            NUMBER_OF_CHALLENGES = int(args[0])
            status = check_database()
            if status is False:
    Severity: Minor
    Found in scripts/seed.py - About 2 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 create_challenge has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def create_challenge(
    Severity: Major
    Found in scripts/seed.py - About 50 mins to fix

      Function create_submission has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def create_submission(
      Severity: Minor
      Found in scripts/seed.py - About 35 mins to fix

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

        def create_challenges(
            number_of_challenges, host_team=None, participant_host_team=None
        ):
            """
            Creates past challenge, on-going challenge and upcoming challenge.
        Severity: Minor
        Found in scripts/seed.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 check_database has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def check_database():
            if len(EmailAddress.objects.all()) > 0:
                print(
                    "Are you sure you want to wipe the existing development database and reseed it? (Y/N)"
                )
        Severity: Minor
        Found in scripts/seed.py - About 25 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

        There are no issues that match your filters.

        Category
        Status