nathan-v/aws_okta_keyman

View on GitHub

Showing 29 of 37 total issues

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

    def auth(self, state_token=None):
        """Perform an initial authentication against Okta.

        The initial Okta Login authentication is handled here - and optionally
        MFA authentication is triggered. If successful, this method stores a
Severity: Minor
Found in aws_okta_keyman/okta.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 user_password has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def user_password(self):
        """Wrap getpass to simplify testing."""
        password = None
        if self.config.password_cache:
            self.log.debug("Password cache enabled")
Severity: Minor
Found in aws_okta_keyman/keyman.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 trigger_duo has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def trigger_duo(self, passcode=""):
        """Try to get a Duo Push without needing an iframe

        Args:
            passcode: String passcode to pass along to the OTP factor
Severity: Minor
Found in aws_okta_keyman/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 main has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def main(self):
        """Execute primary logic path."""
        if self.config.update is True:
            self.update(__version__)
            sys.exit(0)
Severity: Minor
Found in aws_okta_keyman/keyman.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 read_yaml has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def read_yaml(filename, raise_on_error=False):
        """Read a YAML file and optionally raise if anything goes wrong."""
        config = {}
        try:
            if os.path.isfile(filename):
Severity: Minor
Found in aws_okta_keyman/config.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 self.wrap_up(session)
Severity: Major
Found in aws_okta_keyman/keyman.py - About 30 mins to fix

    Function mfa_wait_loop has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def mfa_wait_loop(self, ret, data, sleep=2):
            """Wait loop that keeps checking Okta for MFA status.
    
            Args:
                ret: Dict (JSON) response from a previous API call
    Severity: Minor
    Found in aws_okta_keyman/okta.py - About 25 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 assume_role has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def assume_role(self, print_only=False):
            """Use the SAML Assertion to actually get the credentials.
    
            Uses the supplied (one time use!) SAML Assertion to go out to Amazon
            and get back a set of temporary credentials. These are written out to
    Severity: Minor
    Found in aws_okta_keyman/aws.py - About 25 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 available_roles has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def available_roles(self):
            """Return the roles available from AWS.
    
            Returns: Tuple, list of roles as dicts and a bool that is true when
            multiple accounts were found
    Severity: Minor
    Found in aws_okta_keyman/aws.py - About 25 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