Showing 6 of 60 total issues
TestAccount
has 31 functions (exceeds 20 allowed). Consider refactoring. Open
class TestAccount(TestCase):
def setUp(self):
new_user = AccountFactory.build().user
self.account = AccountFactory.create()
self.user = self.account.user
Function login
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def login(request):
form = None
if request.method == 'POST':
form = LoginForm(request.POST)
if form.is_valid():
- 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_page_info
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def get_page_info(url):
page = Article(url)
page_og = OpenGraph()
image_url = None
global_type = 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 new
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def new(request):
form = None
if request.method == 'POST':
form = URLForm(request.POST)
if form.is_valid():
- 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 upload_avatar
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def upload_avatar(request):
user = request.user
user_avatar = request.FILES.get('user_avatar', None)
if request.method == 'POST' and user_avatar:
ext = os.path.splitext(user_avatar.name)[1]
- 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 settings
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def settings(request):
user = request.user
form = None
if request.method == 'POST':
form = SettingsForm(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"