psono/psono-server

View on GitHub

Showing 423 of 423 total issues

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

            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 request.user and request.user.is_authenticated
              Severity: Major
              Found in psono/restapi/permissions.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 {
                  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_status
                    Severity: Major
                    Found in psono/restapi/utils/duo.py - About 30 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language