Showing 515 of 5,889 total issues
File test_admin_groups.py
has 395 lines of code (exceeds 250 allowed). Consider refactoring. Open
import csv
from django.contrib.auth import get_user_model
from django.core.files.uploadedfile import SimpleUploadedFile
from django.urls import reverse
Function delinquent_students_view
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
def delinquent_students_view(request):
lower_absence_limit = request.GET.get("lower", "")
upper_absence_limit = request.GET.get("upper", "")
include_freshmen = request.GET.get("freshmen", "off") == "on"
- 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 signup.py
has 381 lines of code (exceeds 250 allowed). Consider refactoring. Open
import datetime
import logging
import time
from prometheus_client import Summary
Function post
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def post(self, request):
"""Validate and process the login POST request."""
username = request.POST.get("username", "")
- 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 signUp
has 127 lines of code (exceeds 25 allowed). Consider refactoring. Open
eighth.signUp = function(uid, bid, aid, callback) {
var queryParams = $("#signup-button").hasClass("force") ? "?force" : "";
$.ajax({
url: $("#activity-detail").data("signup-endpoint") + queryParams,
type: "POST",
File views.py
has 375 lines of code (exceeds 250 allowed). Consider refactoring. Open
import logging
from datetime import datetime, timedelta
from dateutil.relativedelta import relativedelta
File tests.py
has 375 lines of code (exceeds 250 allowed). Consider refactoring. Open
import datetime
import json
import urllib.parse
from oauth2_provider.models import AccessToken, get_application_model
File attendance.py
has 374 lines of code (exceeds 250 allowed). Consider refactoring. Open
import csv
import logging
from datetime import MAXYEAR, MINYEAR, date, datetime, timedelta
from cacheops import invalidate_obj
Function getSocket
has 124 lines of code (exceeds 25 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/`);
Function request_announcement_view
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def request_announcement_view(request):
"""The request announcement page."""
if request.method == "POST":
form = AnnouncementRequestForm(request.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
Function generate_statistics_pdf
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def generate_statistics_pdf(activities=None, start_date=None, all_years=False, year=None):
"""Accepts EighthActivity objects and outputs a PDF file."""
if activities is None:
activities = EighthActivity.objects.all().order_by("name")
if year is None:
- 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 schedule_context
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def schedule_context(request=None, date=None, use_cache=True, show_tomorrow=True):
monday = 1
friday = 5
if request and "date" in request.GET:
date = decode_date(request.GET["date"])
- 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 test_attendance.py
has 371 lines of code (exceeds 250 allowed). Consider refactoring. Open
import csv
import tempfile
from django.contrib.auth import get_user_model
from django.urls import reverse
File scheduling.py
has 369 lines of code (exceeds 250 allowed). Consider refactoring. Open
import logging
from cacheops import invalidate_obj
from formtools.wizard.views import SessionWizardView
File views.py
has 366 lines of code (exceeds 250 allowed). Consider refactoring. Open
import calendar
import logging
from datetime import datetime, timedelta
from dateutil.relativedelta import relativedelta
Function get_printers
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def get_printers() -> Dict[str, str]:
"""Returns a dictionary mapping name:description for available printers.
This requires that a CUPS client be configured on the server.
Otherwise, this returns an empty dictionary.
- 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 transfer_students_action
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def transfer_students_action(request):
"""Do the actual process of transferring students."""
if "source_act" in request.GET:
source_act = EighthScheduledActivity.objects.get(id=request.GET.get("source_act"))
elif "source_act" in request.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
Function get_user_info
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def get_user_info(key: str, val) -> Optional[List[User]]:
if key in ["username", "id"]:
try:
u = get_user_model().objects.filter(**{key: val})
except ValueError:
- 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 save_preferred_pic
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def save_preferred_pic(request, user):
preferred_pic = get_preferred_pic(user)
preferred_pic_form = PreferredPictureForm(user, data=request.POST, initial=preferred_pic)
if preferred_pic_form.is_valid():
if preferred_pic_form.has_changed():
- 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 events_view
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def events_view(request):
"""Events homepage.
Shows a list of events occurring in the next week, month, and
future.
- 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"