Showing 13 of 13 total issues
File __init__.py
has 280 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
# -*- coding: utf-8 -*-
#
# Copyright 2013, 2014 Mark Lee
#
# Licensed under the Apache License, Version 2.0 (the "License");
Function otp_setup
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
def otp_setup(request):
confirmed_devices = list(devices_for_user(request.user, True))
tfa_enabled = len(confirmed_devices) > 0
if request.method == 'GET' and not tfa_enabled:
unconfirmed_devices = list(devices_for_user(request.user, False))
- 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 totp_validate
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def totp_validate(secret, now, time_step_size, start_offset, window, otp):
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(self, digits, window, verbose_errors=False, get_secret=None,
Function totp_validate
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def totp_validate(self, secret, now, time_step_size, start_offset, window,
Function generate
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def generate(key_type, key, user, issuer, counter=None, **kwargs):
Function totp_generate
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def totp_generate(secret, now, time_step_size, time_offset, digits):
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(self, digits, window, start_moving_factor,
Function totp_generate
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def totp_generate(self, secret, now, time_step_size, time_offset, digits):
Function hotp_generate
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def hotp_generate(secret, moving_factor, digits, add_checksum=False,
Function generate
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def generate(key_type, key, user, issuer, counter=None):
Function hotp_generate
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def hotp_generate(self, secret, moving_factor, digits, add_checksum=False,
Function otp_verify
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def otp_verify(request):
if request.method == 'POST':
redirect_to = request.POST.get(REDIRECT_FIELD_NAME,
request.GET.get(REDIRECT_FIELD_NAME,
''))
- 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"