psono/psono-server

View on GitHub

Showing 228 of 423 total issues

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

def api_write_datastore(token, session_secret_key, datastore_id, encrypted_data, encrypted_data_nonce):
Severity: Minor
Found in examples/create_secret_in_datastore.py - About 35 mins to fix

    Function post has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def post(self, request, *args, **kwargs):
            """
            Lists multiple secrets
    
            Necessary Rights:
    Severity: Minor
    Found in psono/restapi/views/bulk_secret_read.py - About 35 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 link_shard has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def link_shard(cluster_id: str, shard_id: str, permission: str, fix_link_id=None) -> dict:
    
        if not cluster_id or cluster_id == 'None':
            return {
                'error': 'CLUSTER_ID required'
    Severity: Minor
    Found in psono/restapi/management/commands/fsshardlink.py - About 35 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_shares has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_shares(self, user):
    
                # Generates a list of shares wherever the user has any rights for it and joins the user_share objects
    
                specific_right_share_index = {}
    Severity: Minor
    Found in psono/restapi/views/share.py - About 35 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 put has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def put(self, request, *args, **kwargs):
            """
            Prepares a chunk upload to a file repository
    
            :param request:
    Severity: Minor
    Found in psono/restapi/views/file_repository_upload.py - About 35 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 put has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def put(self, request, *args, **kwargs):
            """
            Creates a signed url for the download of a chunk
    
            :param request:
    Severity: Minor
    Found in psono/restapi/views/file_repository_download.py - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def post(self, request, *args, **kwargs):
            """
            Check the username and authkey and return the REST Token
            if the credentials are valid and authenticated.
    
    
    Severity: Minor
    Found in psono/restapi/views/login.py - About 35 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 main has a Cognitive Complexity of 7 (exceeds 5 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_datastore.py - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def validate(self, attrs: dict) -> dict:
    
            try:
                ivalt = Ivalt.objects.get(user=self.context['request'].user, active=False)
            except Ivalt.DoesNotExist:
    Severity: Minor
    Found in psono/restapi/serializers/activate_ivalt.py - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def get(self, request, security_report_id = None, *args, **kwargs):
            """
            Returns a list of all security reports
    
            :param args:
    Severity: Minor
    Found in psono/administration/views/security_report.py - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def validate(self, attrs: dict) -> dict:
    
            info_json = attrs.get('info', '')
            signature = attrs.get('signature', '')
    
    
    Severity: Minor
    Found in psono/restapi/serializers/api_key_login.py - About 35 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 7 (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_browser.py - About 35 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 7 (exceeds 5 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 35 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 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def validate(self, attrs: dict) -> dict:
    
            yubikey_otp = attrs.get('yubikey_otp', '').strip()
    
            yubikey_is_valid = yubikey_authenticate(yubikey_otp)
    Severity: Minor
    Found in psono/restapi/serializers/yubikey_otp_verify.py - About 35 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 7 (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/revoke_download.py - About 35 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

    Avoid too many return statements within this function.
    Open

        return True
    Severity: Major
    Found in psono/restapi/utils/various.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return check
      Severity: Major
      Found in psono/restapi/utils/duo.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return {
        Severity: Major
        Found in psono/restapi/utils/duo.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              return enrollment
          Severity: Major
          Found in psono/restapi/utils/duo.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                            return
            Severity: Major
            Found in psono/restapi/management/commands/testduoconnection.py - About 30 mins to fix
              Severity
              Category
              Status
              Source
              Language