psono/psono-server

View on GitHub

Showing 423 of 423 total issues

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

    def get(self, request, user_id = None, *args, **kwargs):
        """
        Returns a list of all users or a the infos of a single user

        :param args:
Severity: Minor
Found in psono/administration/views/user.py - About 1 hr 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 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def get(self, request, *args, **kwargs):
        """
        Returns the Server's signed information and some additional data for a nice dashboard

        :param request:
Severity: Minor
Found in psono/administration/views/info.py - About 1 hr to fix

    Function put has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def put(self, request, *args, **kwargs):
            """
            Second step of the recovery code password reset.
            Validates the code and sets the new password.
    
    
    Severity: Minor
    Found in psono/restapi/views/password.py - About 1 hr to fix

      Function api_create_secret has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def api_create_secret(token, session_secret_key, encrypted_data, encrypted_data_nonce, link_id, parent_share_id, callback_url, callback_user, callback_pass):
      Severity: Major
      Found in examples/create_secret_in_share.py - About 1 hr to fix

        Function duo_auth_auth has 9 arguments (exceeds 4 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:
        Severity: Major
        Found in psono/restapi/utils/duo.py - About 1 hr to fix

          Function api_create_secret has 9 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def api_create_secret(token, session_secret_key, encrypted_data, encrypted_data_nonce, link_id, parent_datastore_id, callback_url, callback_user, callback_pass):
          Severity: Major
          Found in examples/create_secret_in_datastore.py - About 1 hr to fix

            Function validate has 28 lines of code (exceeds 25 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_upload.py - About 1 hr to fix

              Function validate_cluster_shard_access has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  def validate_cluster_shard_access(cluster_id, announced_shards):
              
                      fcsls = Fileserver_Cluster_Shard_Link.objects.filter(cluster_id=cluster_id).only('read', 'write', 'delete_capability', 'allow_link_shares').all()
                      shards = {}
                      for fcsl in fcsls:
              Severity: Minor
              Found in psono/restapi/authentication.py - About 1 hr 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 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  def validate(self, attrs: dict) -> dict:
              
                      login_info = attrs.get('login_info')
                      login_info_nonce = attrs.get('login_info_nonce')
                      public_key = attrs.get('public_key')
              Severity: Minor
              Found in psono/restapi/serializers/login.py - About 1 hr 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 10 (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)
              
              
              Severity: Minor
              Found in psono/restapi/serializers/update_share_right.py - About 1 hr 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 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  def validate(self, attrs: dict) -> dict:
                      avatar_id = self.context['request'].parser_context['kwargs'].get('avatar_id', False)
                      user_id = self.context['request'].parser_context['kwargs'].get('user_id', False)
              
              
              
              Severity: Minor
              Found in psono/restapi/serializers/read_avatar.py - About 1 hr 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 10 (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_upload.py - About 1 hr 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 main has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              def main():
                  # 1. Generate the login info including the private key for PFS
                  session_private_key, client_login_info = generate_client_login_info()
              
                  # 2. Send the login request and handle eventual exceptions, problems and so on ...
              Severity: Minor
              Found in examples/create_secret_in_share.py - About 1 hr to fix

                Function validate has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def validate(self, attrs: dict) -> dict:
                
                        title = attrs.get('title', '').strip()
                        integration_key = attrs.get('integration_key', '').strip()
                        secret_key = attrs.get('secret_key', '').strip()
                Severity: Minor
                Found in psono/restapi/serializers/new_duo.py - About 1 hr to fix

                  Function validate has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def validate(self, attrs: dict) -> dict:
                  
                          login_info = attrs.get('login_info')
                          login_info_nonce = attrs.get('login_info_nonce')
                          public_key = attrs.get('public_key')
                  Severity: Minor
                  Found in psono/restapi/serializers/login.py - About 1 hr to fix

                    Function create_secret has 8 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    def create_secret(
                    Severity: Major
                    Found in examples/create_secret_in_share.py - About 1 hr to fix

                      Function decrypt_secret has 8 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      def decrypt_secret(encrypted_secret_hex, encrypted_secret_hex_nonce, password, user_sauce, u, r, p, l) -> bytes:
                      Severity: Major
                      Found in psono/restapi/utils/various.py - About 1 hr to fix

                        Function create_secret has 8 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        def create_secret(
                        Severity: Major
                        Found in examples/create_secret_in_datastore.py - About 1 hr to fix

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

                          def duo_auth_check(integration_key: str, secret_key: str, host: str) -> dict:
                              """
                              Calls the Duo auth check api
                          
                              :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 setup_user_in_baggage_and_spans has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def setup_user_in_baggage_and_spans(user, token):
                              if not is_opentelemetry_enabled():
                                  return
                          
                              current_span = get_current_span()
                          Severity: Minor
                          Found in psono/restapi/telemetry.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

                          Severity
                          Category
                          Status
                          Source
                          Language