psono/psono-server

View on GitHub

Showing 423 of 423 total issues

Function get_ip has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def get_ip(request):
    """
    Analyzes a request and returns the ip of the client.

    :param request:
Severity: Minor
Found in psono/restapi/utils/various.py - About 55 mins to fix

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 duo_auth_auth has a Cognitive Complexity of 9 (exceeds 5 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:
    """
    Auth call with the user id

    :param integration_key: The Duo integration key
Severity: Minor
Found in psono/restapi/utils/duo.py - About 55 mins to fix

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 9 (exceeds 5 allowed). Consider refactoring.
Open

    def get(self, request, *args, **kwargs):
        """
        Returns the user status, e.g. unapproved shares and so on

        :param request:
Severity: Minor
Found in psono/restapi/views/status.py - About 55 mins to fix

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 9 (exceeds 5 allowed). Consider refactoring.
Open

    def post(self, request, *args, **kwargs):
        """
        Use a link share to access a secret.

        :param request:
Severity: Minor
Found in psono/restapi/views/link_share_access.py - About 55 mins to fix

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 duo_auth_enroll_status has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def duo_auth_enroll_status(integration_key: str, secret_key: str, host: str, user_id: str, activation_code: str) -> dict:
    """
    Anonymous enrollment of a new device

    :param integration_key: The Duo integration key
Severity: Minor
Found in psono/restapi/utils/duo.py - About 55 mins to fix

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 9 (exceeds 5 allowed). Consider refactoring.
Open

    def validate(self, attrs: dict) -> dict:
        parent_share_id = attrs.get('parent_share_id', None)
        parent_datastore_id = attrs.get('parent_datastore_id', None)


Severity: Minor
Found in psono/restapi/serializers/bulk_create_secret.py - About 55 mins to fix

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 9 (exceeds 5 allowed). Consider refactoring.
Open

    def validate(self, attrs: dict) -> dict:

        secret_id = attrs.get('secret_id', None)
        file_id = attrs.get('file_id', None)
        allowed_reads = attrs.get('allowed_reads', None)
Severity: Minor
Found in psono/restapi/serializers/create_link_share.py - About 55 mins to fix

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 9 (exceeds 5 allowed). Consider refactoring.
Open

    def validate(self, attrs: dict) -> dict:
        parent_share_id = attrs.get('parent_share_id', None)
        parent_datastore_id = attrs.get('parent_datastore_id', None)

        if parent_share_id is None and parent_datastore_id is None:
Severity: Minor
Found in psono/restapi/serializers/create_secret.py - About 55 mins to fix

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 save has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def save(self, *args, **kwargs):

        try:
            stored_user = User.objects.get(pk=self.id)

Severity: Minor
Found in psono/restapi/models.py - About 55 mins to fix

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 9 (exceeds 5 allowed). Consider refactoring.
Open

    def validate(self, attrs: dict) -> dict:

        user_id = attrs.get('user_id')
        is_active = attrs.get('is_active', None)
        is_email_active = attrs.get('is_email_active', None)
Severity: Minor
Found in psono/administration/serializers/update_user.py - About 55 mins to fix

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 9 (exceeds 5 allowed). Consider refactoring.
Open

    def validate(self, attrs: dict) -> dict:

        api_key_id = attrs.get('api_key_id')
        secret_id = attrs.get('secret_id')
        api_key_secret_key = attrs.get('api_key_secret_key', False)
Severity: Minor
Found in psono/restapi/serializers/read_secret_with_api_key.py - About 55 mins to fix

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 9 (exceeds 5 allowed). Consider refactoring.
Open

    def validate(self, attrs: dict) -> dict:
        parent_share_id = attrs.get('parent_share_id', None)
        parent_datastore_id = attrs.get('parent_datastore_id', None)
        key_type = attrs.get('key_type')

Severity: Minor
Found in psono/restapi/serializers/create_share.py - About 55 mins to fix

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 9 (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')
Severity: Minor
Found in psono/fileserver/serializers/authorize_download.py - About 55 mins to fix

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 encrypt_secret has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

def encrypt_secret(secret, password, user_sauce, u, r, p, l) -> Tuple[bytes, bytes]:
Severity: Major
Found in psono/restapi/utils/various.py - About 50 mins to fix

    Function generate_authkey has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def generate_authkey(username, password, u, r, p, l) -> bytes:
    Severity: Minor
    Found in psono/restapi/utils/various.py - About 45 mins to fix

      Function s3_delete has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def s3_delete(bucket, region, access_key_id, secret_access_key, hash_checksum, endpoint_url=None):
      Severity: Minor
      Found in psono/restapi/utils/s3.py - About 45 mins to fix

        Function construct_signed_url has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def construct_signed_url(bucket, json_key, hash_checksum, method, content_type='', md5_digest=''):
        Severity: Minor
        Found in psono/restapi/utils/gcp.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  for f in ['logo.png']:
                                      fp = open(os.path.join(os.path.dirname(__file__), '..', '..', 'static', 'email', f), 'rb')
          
                                      msg_img = MIMEImage(fp.read())
                                      fp.close()
          Severity: Major
          Found in psono/restapi/views/share_right.py - About 45 mins to fix

            Function filter_as_json has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            def filter_as_json(data, filter):
                """
                Takes any string and interprets it as nested json encoded objects which will be filtered by the filter array.
                The function will return a string with the filtered content
            
            
            Severity: Minor
            Found in psono/restapi/utils/various.py - About 45 mins to fix

            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 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def delete(self, request, *args, **kwargs):
                    """
                    Delete a Share_Right obj
            
                    Necessary Rights:
            Severity: Minor
            Found in psono/restapi/views/share_right.py - About 45 mins to fix

            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

            Severity
            Category
            Status
            Source
            Language