Showing 228 of 423 total issues
File various.py
has 1048 lines of code (exceeds 250 allowed). Consider refactoring. Open
from django.conf import settings
from django.contrib.auth.hashers import check_password, make_password
from django.core.cache import cache
from django.db import connection
from urllib.parse import urlparse
File models.py
has 954 lines of code (exceeds 250 allowed). Consider refactoring. Open
from django.db.models.signals import post_save, post_delete
from django.db import models
from django.dispatch import receiver
from django.core.cache import cache
from django.conf import settings
File app_settings.py
has 773 lines of code (exceeds 250 allowed). Consider refactoring. Open
from django.conf import settings
from importlib import import_module
from .serializers import (
File settings.py
has 571 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
Django settings for psono project.
Generated by 'django-admin startproject' using Django 1.8.3.
Function put
has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring. Open
def put(self, request, *args, **kwargs):
"""
Create Share_Right
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 validate
has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring. Open
def validate(self, attrs: dict) -> dict:
file_repository_id = attrs.get('file_repository_id')
title = attrs.get('title', '').strip()
type = attrs.get('type', '').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 validate
has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring. Open
def validate(self, attrs: dict) -> dict:
title = attrs.get('title', '').strip()
type = attrs.get('type', '').lower().strip()
gcp_cloud_storage_bucket = attrs.get('gcp_cloud_storage_bucket', '').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 user_has_rights_on_secret
has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring. Open
def user_has_rights_on_secret(user_id: str, secret_id: Union[str, List[str]], read: bool = None, write: bool = None) -> Union[bool, List[bool]]: #nosec B105, B107
"""
Checks if the given user has the requested rights for the given secret
:param 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
File authorize_upload.py
has 463 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 calculate_user_rights_on_share
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
def calculate_user_rights_on_share(user_id: str, share_id: Union[str, List[str]]) -> Union[dict, List[dict], None]:
"""
Calculates the user's rights on a share
:param 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 37 (exceeds 5 allowed). Consider refactoring. Open
def validate(self, attrs: dict) -> dict:
link_share_id = attrs.get('link_share_id')
passphrase = attrs.get('passphrase', '')
- 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 create_secret_in_share.py
has 393 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
A small demo script that shows how to create a secret in a shared folder (unrestricted API key)
"""
import uuid
import requests
Function validate
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
def validate(self, attrs: dict) -> dict:
link_share_id = attrs.get('link_share_id')
passphrase = attrs.get('passphrase', '')
- 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 post
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def post(self, request, *args, **kwargs):
"""
Creates a new security report
: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 get
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def get(self, request, file_repository_id=None, *args, **kwargs):
"""
Returns either a list of all file_repositories with own access privileges or the members specified file_repository
: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
File create_secret_in_datastore.py
has 365 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
A small demo script that shows how to create a secret in a datastore (unrestricted API key)
"""
import uuid
import requests
Function validate
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def validate(self, attrs: dict) -> dict:
email = attrs.get('email')
authkey_old = attrs.get('authkey_old')
authkey = attrs.get('authkey', False)
hashing_algorithm = attrs.get('hashing_algorithm', '')
- 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 authorize_download.py
has 362 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
File export_as_json.py
has 357 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
A small demo script that shows how to export the datastore (unrestricted API key)
"""
import requests
import json
File authentication.py
has 351 lines of code (exceeds 250 allowed). Consider refactoring. Open
import os
from datetime import timedelta
from django.conf import settings
from django.utils import timezone
from django.utils.crypto import constant_time_compare