Showing 423 of 423 total issues
Function get
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def get(self, request, user_id = None, *args, **kwargs):
"""
Returns a list of all users or a the infos of a single user
:param args:
- 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
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get(self, request, *args, **kwargs):
"""
Returns the Server's signed information and some additional data for a nice dashboard
:param request:
Function put
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def put(self, request, *args, **kwargs):
"""
Second step of the recovery code password reset.
Validates the code and sets the new password.
Function api_create_secret
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def api_create_secret(token, session_secret_key, encrypted_data, encrypted_data_nonce, link_id, parent_share_id, callback_url, callback_user, callback_pass):
Function duo_auth_auth
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def duo_auth_auth(integration_key: str, secret_key: str, host: str, username: str, factor: str, device: str = None, pushinfo: str = None, passcode: str = None, async_txn: bool = False) -> dict:
Function api_create_secret
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def api_create_secret(token, session_secret_key, encrypted_data, encrypted_data_nonce, link_id, parent_datastore_id, callback_url, callback_user, callback_pass):
Function validate
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def validate(self, attrs: dict) -> dict:
file_transfer_id = attrs.get('file_transfer_id')
ticket_encrypted = attrs.get('ticket')
ticket_nonce = attrs.get('ticket_nonce')
Function validate_cluster_shard_access
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def validate_cluster_shard_access(cluster_id, announced_shards):
fcsls = Fileserver_Cluster_Shard_Link.objects.filter(cluster_id=cluster_id).only('read', 'write', 'delete_capability', 'allow_link_shares').all()
shards = {}
for fcsl in fcsls:
- 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 validate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def validate(self, attrs: dict) -> dict:
login_info = attrs.get('login_info')
login_info_nonce = attrs.get('login_info_nonce')
public_key = attrs.get('public_key')
- 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 validate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def validate(self, attrs: dict) -> dict:
user_id = attrs.get('user_id', False)
group_id = attrs.get('group_id', 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 validate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def validate(self, attrs: dict) -> dict:
avatar_id = self.context['request'].parser_context['kwargs'].get('avatar_id', False)
user_id = self.context['request'].parser_context['kwargs'].get('user_id', 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 validate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def validate(self, attrs: dict) -> dict:
file_transfer_id = attrs.get('file_transfer_id')
ticket_encrypted = attrs.get('ticket')
ticket_nonce = attrs.get('ticket_nonce')
- 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 main
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def main():
# 1. Generate the login info including the private key for PFS
session_private_key, client_login_info = generate_client_login_info()
# 2. Send the login request and handle eventual exceptions, problems and so on ...
Function validate
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def validate(self, attrs: dict) -> dict:
title = attrs.get('title', '').strip()
integration_key = attrs.get('integration_key', '').strip()
secret_key = attrs.get('secret_key', '').strip()
Function validate
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def validate(self, attrs: dict) -> dict:
login_info = attrs.get('login_info')
login_info_nonce = attrs.get('login_info_nonce')
public_key = attrs.get('public_key')
Function create_secret
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_secret(
Function decrypt_secret
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def decrypt_secret(encrypted_secret_hex, encrypted_secret_hex_nonce, password, user_sauce, u, r, p, l) -> bytes:
Function create_secret
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_secret(
Function duo_auth_check
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def duo_auth_check(integration_key: str, secret_key: str, host: str) -> dict:
"""
Calls the Duo auth check api
:param integration_key: The Duo integration key
- 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 setup_user_in_baggage_and_spans
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def setup_user_in_baggage_and_spans(user, token):
if not is_opentelemetry_enabled():
return
current_span = get_current_span()
- 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"