Showing 515 of 5,889 total issues

Function eighth_admin_distribute_action has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
Open

def eighth_admin_distribute_action(request):
    if "users" in request.POST:
        activity_user_map = {}
        for item in request.POST:
            if item[:6] == "schact":
Severity: Minor
Found in intranet/apps/eighth/views/admin/groups.py - About 1 day 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 signup.js has 523 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* global $ */
var eighth = {};

$(function() {
    eighth.Activity = Backbone.Model.extend({
Severity: Major
Found in intranet/static/js/eighth/signup.js - About 1 day to fix

    Function admin_daytype_view has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
    Open

    def admin_daytype_view(request, daytype_id=None):
        if request.method == "POST":
            delete_cache()
            if "id" in request.POST:
                daytype_id = request.POST["id"]
    Severity: Minor
    Found in intranet/apps/schedule/views.py - About 1 day 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 logs_view has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
    Open

    def logs_view(request):
        if not request.user.is_global_admin:
            raise Http404
    
        context = {
    Severity: Minor
    Found in intranet/apps/logs/views.py - About 1 day 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 getSocket has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
    Open

    export function getSocket(base_url, location, document, window, time) {
        const protocol = (location.protocol.indexOf('s') > -1) ? 'wss' : 'ws';
        let socket;
        if (base_url !== '') {
            socket = new ReconnectingWebSocket(`${protocol}://${base_url}/bus/`);
    Severity: Minor
    Found in intranet/static/js/bus-shared.js - 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 tests.py has 478 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import datetime
    import io
    import os
    
    from oauth2_provider.models import AccessToken, get_application_model
    Severity: Minor
    Found in intranet/apps/users/tests.py - About 7 hrs to fix

      Function eighthSearch has 181 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function eighthSearch(q) {
              var _st = +new Date();
      
              var searchStr = $(this).val().toLowerCase();
              searchStr = $.trim(searchStr);
      Severity: Major
      Found in intranet/static/js/eighth/signup.search.js - About 7 hrs to fix

        Function stats_multiple_view has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
        Open

        def stats_multiple_view(request):
            if not request.user.is_eighth_admin:
                return render(request, "error/403.html", {"reason": "You do not have permission to view eighth activity statistics."}, status=403)
        
            form = None
        Severity: Minor
        Found in intranet/apps/eighth/views/activities.py - About 6 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 handle has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
        Open

            def handle(self, *args, **options):
                log = not options["silent"]
                if options["everyone"]:
                    users = get_user_model().objects.get_students()
                else:
        Severity: Minor
        Found in intranet/apps/eighth/management/commands/signup_status_email.py - About 6 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 435 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import base64
        import datetime
        import logging
        import os
        import re
        Severity: Minor
        Found in intranet/apps/files/views.py - About 6 hrs to fix

          Function save_privacy_options has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
          Open

          def save_privacy_options(request, user):
              privacy_options = get_privacy_options(user)
              privacy_options_form = PrivacyOptionsForm(user, data=request.POST, initial=privacy_options)
              if privacy_options_form.is_valid():
                  if privacy_options_form.has_changed():
          Severity: Minor
          Found in intranet/apps/preferences/views.py - About 6 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 423 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import logging
          from datetime import datetime, time, timedelta
          from itertools import chain
          
          from django.conf import settings
          Severity: Minor
          Found in intranet/apps/dashboard/views.py - About 6 hrs to fix

            Function dashboard_view has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
            Open

            def dashboard_view(request, show_widgets=True, show_expired=False, ignore_dashboard_types=None, show_welcome=False):
                """Process and show the dashboard, which includes activities, events, and widgets."""
            
                user = request.user
                now = timezone.localtime()
            Severity: Minor
            Found in intranet/apps/dashboard/views.py - About 6 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 files_delete has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
            Open

            def files_delete(request, fstype=None):
                if "confirm" in request.POST:
                    filepath = request.POST.get("path", None)
                else:
                    filepath = request.GET.get("dir", None)
            Severity: Minor
            Found in intranet/apps/files/views.py - About 6 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 snow.js has 417 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /* Iodine (Intranet2) Snow Script
             * Credits: dmorris, zyaro
             * Modified for Ion (Intranet3) by: 2016jwoglom, 2025azhu
             */
            $(function () {
            Severity: Minor
            Found in intranet/static/themes/snow/snow.js - About 6 hrs to fix

              Function save_bus_route has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
              Open

              def save_bus_route(request, user):
                  bus_route = get_bus_route(user)
                  bus_route_form = BusRouteForm(data=request.POST, initial=bus_route)
                  if bus_route_form.is_valid():
                      if bus_route_form.has_changed():
              Severity: Minor
              Found in intranet/apps/preferences/views.py - About 5 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 upload_group_members_view has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
              Open

              def upload_group_members_view(request, group_id):
                  try:
                      group = Group.objects.get(id=group_id)
                  except Group.DoesNotExist as e:
                      raise http.Http404 from e
              Severity: Minor
              Found in intranet/apps/eighth/views/admin/groups.py - About 5 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 activities.py has 405 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import csv
              import logging
              from collections import defaultdict
              from datetime import MAXYEAR, MINYEAR, date, datetime, timedelta
              from io import BytesIO
              Severity: Minor
              Found in intranet/apps/eighth/views/activities.py - About 5 hrs to fix

                Function find_users_input has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                Open

                def find_users_input(lines: List[str]):
                    sure_users = []
                    unsure_users = []
                    for line in lines:
                        done = False
                Severity: Minor
                Found in intranet/apps/eighth/views/admin/groups.py - About 5 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 fetch_activity_list_with_metadata has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                Open

                    def fetch_activity_list_with_metadata(self, block):
                        user = self.context.get("user", self.context["request"].user)
                
                        if user:
                            favorited_activities = set(user.favorited_activity_set.values_list("id", flat=True))
                Severity: Minor
                Found in intranet/apps/eighth/serializers.py - About 5 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

                Severity
                Category
                Status
                Source
                Language