HackAssistant/registration

View on GitHub

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
Severity: Major
Found in applications/forms.py - About 1 day to fix

    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
    Severity: Minor
    Found in organizers/views.py - About 7 hrs to fix

      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
      Severity: Minor
      Found in stats/views.py - About 7 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

      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
      
      
      Severity: Minor
      Found in applications/models.py - About 5 hrs to fix

        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()
        Severity: Critical
        Found in checkin/models.py - About 4 hrs to fix

          BaseApplication has 30 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class BaseApplication(models.Model):
          
              class Meta:
                  abstract = True
          
          
          Severity: Minor
          Found in applications/models.py - About 3 hrs to fix

            Function checkin_qr has 84 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            let checkin_qr = (()=>{
                let obj = {}
                let cams = []
            
                obj.initScanner = ()=>{
            Severity: Major
            Found in checkin/static/js/checkin.js - About 3 hrs to fix

              User has 28 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class User(AbstractBaseUser):
                  email = models.EmailField(
                      verbose_name='email',
                      max_length=255,
                      unique=True,
              Severity: Minor
              Found in user/models.py - About 3 hrs to fix

                Function checkin_qr has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                let checkin_qr = (()=>{
                    let obj = {}
                    let cams = []
                
                    obj.initScanner = ()=>{
                Severity: Major
                Found in checkin/static/js/checkin_add.js - About 3 hrs to fix

                  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:
                  Severity: Critical
                  Found in organizers/views.py - About 3 hrs to fix

                    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
                    Severity: Minor
                    Found in stats/views.py - About 2 hrs to fix

                      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:
                      Severity: Minor
                      Found in app/views.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 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':
                      Severity: Minor
                      Found in user/views.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

                      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
                      Severity: Minor
                      Found in applications/views.py - About 2 hrs to fix

                        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
                        Severity: Minor
                        Found in user/views.py - About 2 hrs to fix

                          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:
                          Severity: Minor
                          Found in reimbursement/models.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 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)
                          
                          
                          Severity: Minor
                          Found in checkin/static/js/checkin.js - About 2 hrs to fix

                            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
                            Severity: Minor
                            Found in stats/views.py - About 1 hr to fix

                              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)
                              
                              
                              Severity: Minor
                              Found in checkin/static/js/checkin_add.js - About 1 hr to fix

                                Function checkin_qr has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                                Open

                                let checkin_qr = (()=>{
                                    let obj = {}
                                    let cams = []
                                
                                    obj.initScanner = ()=>{
                                Severity: Minor
                                Found in checkin/static/js/checkin_add.js - 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

                                Severity
                                Category
                                Status
                                Source
                                Language