Showing 69 of 274 total issues
File forms.py
has 501 lines of code (exceeds 250 allowed). Consider refactoring. Open
from django import forms
from django.conf import settings
from django.forms import ModelForm
from django.template.defaultfilters import filesizeformat
from django.utils import timezone
File views.py
has 482 lines of code (exceeds 250 allowed). Consider refactoring. Open
# Create your views here.
from django.conf import settings
from django.contrib import messages
from django.core.exceptions import ValidationError
from django.db import IntegrityError
Function get_stats
has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring. Open
def get_stats(model):
hacker = model == HackerApplication
volunteer = model == VolunteerApplication
mentor = model == MentorApplication
sponsor = model == SponsorApplication
- 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
File models.py
has 412 lines of code (exceeds 250 allowed). Consider refactoring. Open
from __future__ import unicode_literals
import json
import uuid as uuid
Consider simplifying this complex logical expression. Open
if (self.hacker and self.sponsor is None and self.volunteer is None and self.mentor is None) or \
(self.hacker is None and self.sponsor and self.volunteer is None and self.mentor is None) or \
(self.hacker is None and self.sponsor is None and self.volunteer and self.mentor is None) or \
(self.hacker is None and self.sponsor is None and self.volunteer is None and self.mentor):
self.update_time = timezone.now()
BaseApplication
has 30 functions (exceeds 20 allowed). Consider refactoring. Open
class BaseApplication(models.Model):
class Meta:
abstract = True
Function checkin_qr
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
let checkin_qr = (()=>{
let obj = {}
let cams = []
obj.initScanner = ()=>{
User
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
class User(AbstractBaseUser):
email = models.EmailField(
verbose_name='email',
max_length=255,
unique=True,
Function checkin_qr
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
let checkin_qr = (()=>{
let obj = {}
let cams = []
obj.initScanner = ()=>{
Consider simplifying this complex logical expression. Open
if request.POST.get('add_comment'):
add_comment(application, request.user, comment_text)
elif request.POST.get('invite') and request.user.is_director:
self.invite_application(application)
elif request.POST.get('confirm') and request.user.is_director:
File views.py
has 288 lines of code (exceeds 250 allowed). Consider refactoring. Open
from django.conf import settings
from django.db.models import Count, Sum, F
from django.db.models.functions import TruncDate, TruncHour
from django.http import JsonResponse
from django.urls import reverse
Function protectedMedia
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def protectedMedia(request, file_):
path, file_name = os.path.split(file_)
downloadable_path = None
if path == "resumes":
try:
- 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 login
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def login(request):
if request.user.is_authenticated:
return HttpResponseRedirect(reverse('root'))
# if this is a POST request we need to process the form data
if request.method == 'POST':
- 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
File views.py
has 273 lines of code (exceeds 250 allowed). Consider refactoring. Open
# Create your views here.
from __future__ import print_function
import logging
from datetime import timedelta
File views.py
has 260 lines of code (exceeds 250 allowed). Consider refactoring. Open
import random
import string
from django.conf import settings
from django.contrib import auth, messages
Function check_friend_emails
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def check_friend_emails(friend_emails, user_email):
emails = friend_emails.replace(' ', '').split(',')
if user_email in emails:
raise Exception('%s is your own email' % user_email)
for email in emails:
- 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 qrScan
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
obj.qrScan = (inputElem)=>{
if(!cams) console.error("I can't scan without a camera")
if(!localStorage.getItem("selectedCam"))
localStorage.setItem("selectedCam", 0)
Function get_stats
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_stats(model):
hacker = model == HackerApplication
volunteer = model == VolunteerApplication
mentor = model == MentorApplication
sponsor = model == SponsorApplication
Function qrScan
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
obj.qrScan = (inputElem)=>{
if(!cams) console.error("I can't scan without a camera")
if(!localStorage.getItem("selectedCam"))
localStorage.setItem("selectedCam", 0)
Function checkin_qr
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
let checkin_qr = (()=>{
let obj = {}
let cams = []
obj.initScanner = ()=>{
- 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"