Showing 228 of 423 total issues
Function validate
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def validate(self, attrs: dict) -> dict:
shard_id = attrs.get('shard_id', None)
file_repository_id = attrs.get('file_repository_id', None)
parent_share_id = attrs.get('parent_share_id', 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 handle
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def handle(self, *args, **options):
integration_key = options['integration_key']
secret_key = options['secret_key']
host = options['host']
- 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_all_secrets
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def get_all_secrets(datastore, token, session_secret_key, include_trash_bin_items=False):
def handle_items(items):
for item in items:
if not "secret_id" in item:
- 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 revoke_download.py
has 318 lines of code (exceeds 250 allowed). Consider refactoring. Open
from django.urls import reverse
from django.conf import settings
from django.utils import timezone
from datetime import timedelta
from rest_framework import status
Function authenticate
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def authenticate(self, request):
token_hash = self.get_token_hash(request)
token = self.get_db_token(token_hash)
user = get_cache(User, token.user_id)
- 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 24 (exceeds 5 allowed). Consider refactoring. Open
def validate(self, attrs: dict) -> dict:
user_id = attrs.get('user_id', '')
user_username = attrs.get('user_username', '').lower().strip()
user_email = attrs.get('user_email', '').lower().strip()
- 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 filter_datastore_export
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def filter_datastore_export(folder, include_trash_bin_items=False):
unwanted_folder_properties = [
"id",
"datastore_id",
- 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 delete
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def delete(self, request, *args, **kwargs):
"""
Delete File_Link obj
Necessary Rights:
- 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_all_shares
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def get_all_shares(folder, token, session_secret_key):
def handle_share(share):
share_read_result = api_read_share(token, session_secret_key, share['share_id'])
share_content = 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 authenticate
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def authenticate(username: str = "", user: User = None, authkey: str = "", password: str = "") -> Tuple: # nosec
"""
Checks if the authkey for the given user, specified by the email or directly by the user object matches
:param username: str
- 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 user.py
has 283 lines of code (exceeds 250 allowed). Consider refactoring. Open
from django.conf import settings
from django.db.models import Q, Exists, OuterRef
from rest_framework import status
from rest_framework.response import Response
from rest_framework.generics import GenericAPIView
Function get
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def get(self, request, user_share_right_id = None, *args, **kwargs):
"""
Returns a specific Share_Right or a list of all the Share_Rights of the user who requested it
:param request:
- 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 20 (exceeds 5 allowed). Consider refactoring. Open
def validate(self, attrs: dict) -> dict:
link_id = str(attrs.get('link_id')).replace("-", "")
new_parent_share_id = attrs.get('new_parent_share_id', None)
new_parent_datastore_id = attrs.get('new_parent_datastore_id', 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 validate
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def validate(self, attrs: dict) -> dict:
duo_id = attrs.get('duo_id', '')
duo_token = attrs.get('duo_token', 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
File share_right.py
has 277 lines of code (exceeds 250 allowed). Consider refactoring. Open
import os
from collections import defaultdict
from rest_framework import status
from rest_framework.response import Response
Function validate
has a Cognitive Complexity of 19 (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)
share_id = attrs['share_id']
- 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 19 (exceeds 5 allowed). Consider refactoring. Open
def validate(self, attrs: dict) -> dict:
duo_token = attrs.get('duo_token', None)
token = self.context['request'].auth
- 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 api_key_with_session.py
has 271 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
A small demo script that shows how to access the datastore with a session (unrestricted API key) and modify a secret
"""
import requests
import json
Function post
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def post(self, request, *args, **kwargs):
"""
Updates a secret
Necessary Rights:
- 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 fileserver_access
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def fileserver_access(cmsl, ip_address, read=None, write=None, allow_link_shares=None):
"""
Tests weather an ip address has access for a specific cluster member shard link
:param cmsl:
- 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"