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
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:
- Read upRead up
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(
Function create_submission
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_submission(
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.
- Read upRead up
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)"
)
- Read upRead up
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"