psono/psono-server

View on GitHub

Showing 228 of 423 total issues

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

        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
                    Severity
                    Category
                    Status
                    Source
                    Language