duncanmmacleod/igwn-auth-utils

View on GitHub

Showing 14 of 14 total issues

File requests.py has 494 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
# Copyright 2021-2023 Cardiff University
# Distributed under the terms of the BSD-3-Clause license

"""Python Requests interface with IGWN authentication.
Severity: Minor
Found in igwn_auth_utils/requests.py - About 7 hrs to fix

    Function _prepare_auth has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

    def _prepare_auth(
        url=None,
        auth=None,
        cert=None,
        token=None,
    Severity: Minor
    Found in igwn_auth_utils/requests.py - About 5 hrs 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

    File scitokens.py has 304 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    # Copyright 2021 Cardiff University
    # Distributed under the terms of the BSD-3-Clause license
    
    """Utility functions for discovering valid scitokens
    Severity: Minor
    Found in igwn_auth_utils/scitokens.py - About 3 hrs to fix

      Function is_valid_token has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      def is_valid_token(
          token,
          audience,
          scope,
          issuer=None,
      Severity: Minor
      Found in igwn_auth_utils/scitokens.py - About 2 hrs 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 request has 12 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def request(
      Severity: Major
      Found in igwn_auth_utils/requests.py - About 1 hr to fix

        Function find_token has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

        def find_token(
            audience,
            scope,
            issuer=None,
            timeleft=600,
        Severity: Minor
        Found in igwn_auth_utils/scitokens.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 _prepare_auth has 10 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def _prepare_auth(
        Severity: Major
        Found in igwn_auth_utils/requests.py - About 1 hr to fix

          Function __init__ has 10 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def __init__(
          Severity: Major
          Found in igwn_auth_utils/requests.py - About 1 hr to fix

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

            def _find_tokens(**deserialize_kwargs):
                """Yield all tokens that we can find
            
                This function will `yield` exceptions that are raised when
                attempting to parse a token that was actually found, so that
            Severity: Minor
            Found in igwn_auth_utils/scitokens.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 linkcode_resolve has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            def linkcode_resolve(domain, info):
                """Determine the URL corresponding to Python object
            
                This code is stolen with thanks from the scipy team.
                """
            Severity: Minor
            Found in docs/conf.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 find_token has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def find_token(
            Severity: Major
            Found in igwn_auth_utils/scitokens.py - About 50 mins to fix

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

              def find_credentials(timeleft=600):
                  """Locate X509 certificate and (optionally) private key files.
              
                  This function checks the following paths in order:
              
              
              Severity: Minor
              Found in igwn_auth_utils/x509.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 is_valid_token has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def is_valid_token(
              Severity: Minor
              Found in igwn_auth_utils/scitokens.py - About 45 mins to fix

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

                def request(method, url, *args, session=None, **kwargs):
                Severity: Minor
                Found in igwn_auth_utils/requests.py - About 35 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language