psono/psono-server

View on GitHub

Showing 423 of 423 total issues

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

    def get(self, request, datastore_id = None, *args, **kwargs):
        """
        Lists all datastores of the user or returns a specific datastore with content

        :param request:
Severity: Minor
Found in psono/restapi/views/datastore.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 s3_construct_signed_download_url has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

def s3_construct_signed_download_url(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 post has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def post(self, request, *args, **kwargs):
            """
            Updates a specific datastore
    
            :param request:
    Severity: Minor
    Found in psono/restapi/views/datastore.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 create_url has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def create_url(client_id_email, key, method, path, content_type='', content_md5=''):
    Severity: Minor
    Found in psono/restapi/utils/gcp.py - About 45 mins to fix

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

      def s3_construct_signed_upload_url(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 validate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def validate(self, attrs: dict) -> dict:
                verification_hex = attrs.get('verification', '')
                verification = nacl.encoding.HexEncoder.decode(verification_hex)
                verification_nonce_hex = attrs.get('verification_nonce', '')
                verification_nonce = nacl.encoding.HexEncoder.decode(verification_nonce_hex)
        Severity: Minor
        Found in psono/restapi/serializers/activate_token.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 get has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def get(self, request, *args, **kwargs):
                """
                Returns the statistics of used devices
        
                :param args:
        Severity: Minor
        Found in psono/administration/views/stats_device.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 get has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def get(self, request, *args, **kwargs):
                """
                Returns the statistics of used operations_systems
        
                :param args:
        Severity: Minor
        Found in psono/administration/views/stats_os.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 validate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def validate(self, attrs: dict) -> dict:
                user_id = self.context['request'].parser_context['kwargs'].get('user_id', False)
        
                if user_id:
                    try:
        Severity: Minor
        Found in psono/administration/serializers/read_user.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 validate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def validate(self, attrs: dict) -> dict:
                group_id = self.context['request'].parser_context['kwargs'].get('group_id', False)
        
                if group_id:
                    try:
        Severity: Minor
        Found in psono/administration/serializers/read_group.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 get has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def get(self, request, *args, **kwargs):
                """
                Returns the chunks that should be cleaned up by this fileserver
        
                :param request:
        Severity: Minor
        Found in psono/fileserver/views/cleanup_chunks.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 validate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def validate(self, attrs: dict) -> dict:
                group_id = self.context['request'].parser_context['kwargs'].get('group_id', False)
        
                if group_id:
                    try:
        Severity: Minor
        Found in psono/administration/serializers/read_session.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

        Consider simplifying this complex logical expression.
        Open

                    if authkey_changed or public_key_changed  or secret_key_changed  or secret_key_nonce_changed  or private_key_changed  or private_key_nonce_changed:
        
                        if hashing_parameters_changed or hashing_algorithm_changed:
                            Old_Credential.objects.filter(user_id=stored_user.id).delete()
        
        
        Severity: Major
        Found in psono/restapi/models.py - About 40 mins to fix

          Function fileserver_access has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def fileserver_access(cmsl, ip_address, read=None, write=None, allow_link_shares=None):
          Severity: Minor
          Found in psono/restapi/utils/various.py - About 35 mins to fix

            Function do_delete has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def do_delete(bucket, region, access_key_id, secret_access_key, hash_checksum):
            Severity: Minor
            Found in psono/restapi/utils/do.py - About 35 mins to fix

              Function user_has_rights_on_file_repository has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def user_has_rights_on_file_repository(user_id: str = "", file_repository_id: str = "", read: bool = None, write: bool = None, grant: bool = None) -> bool:
              Severity: Minor
              Found in psono/restapi/utils/various.py - About 35 mins to fix

                Function do_construct_signed_upload_url has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def do_construct_signed_upload_url(bucket, region, access_key_id, secret_access_key, hash_checksum):
                Severity: Minor
                Found in psono/restapi/utils/do.py - About 35 mins to fix

                  Function api_request has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def api_request(method, endpoint, data = None, token = None, session_secret_key = None):
                  Severity: Minor
                  Found in examples/export_as_json.py - About 35 mins to fix

                    Function do_construct_signed_download_url has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    def do_construct_signed_download_url(bucket, region, access_key_id, secret_access_key, hash_checksum):
                    Severity: Minor
                    Found in psono/restapi/utils/do.py - About 35 mins to fix

                      Function backblaze_construct_signed_download_url has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      def backblaze_construct_signed_download_url(bucket, region, access_key_id, secret_access_key, hash_checksum):
                      Severity: Minor
                      Found in psono/restapi/utils/backblaze.py - About 35 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language