src/users/views.py
File views.py
has 305 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.contrib.auth import authenticate
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User, Permission
Function register
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
def register(request):
if request.method == "GET":
return render(request, 'userRegister/register.html')
else:
- 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 edit_user
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def edit_user(request, user_id):
user = User.objects.get(id=user_id)
if request.method == "GET":
- 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
Avoid too many return
statements within this function. Open
Open
return render(request, 'users/dashboard.html')
Error: inconsistent use of tabs and spaces in indentation (<unknown>, line 145)</unknown> Open
Open
from django.core import mail
- Read upRead up
- Exclude checks
We encountered an error attempting to analyze this line.