nathan-v/aws_okta_keyman

View on GitHub

Showing 35 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

    Line too long (84 > 79 characters)
    Open

                (dict(zip(["role", "principle"], self.sort_roles(self.split_roles(x)))))
    Severity: Minor
    Found in aws_okta_keyman/aws_saml.py by pep8

    Limit all lines to a maximum of 79 characters.

    There are still many devices around that are limited to 80 character
    lines; plus, limiting windows to 80 characters makes it possible to
    have several windows side-by-side.  The default wrapping on such
    devices looks ugly.  Therefore, please limit all lines to a maximum
    of 79 characters. For flowing long blocks of text (docstrings or
    comments), limiting the length to 72 characters is recommended.
    
    Reports error E501.

    Line too long (86 > 79 characters)
    Open

        fmt = "%(asctime)-8s (%(bold)s%(log_color)s%(levelname)s%(reset)s) " "%(message)s"
    Severity: Minor
    Found in aws_okta_keyman/__main__.py by pep8

    Limit all lines to a maximum of 79 characters.

    There are still many devices around that are limited to 80 character
    lines; plus, limiting windows to 80 characters makes it possible to
    have several windows side-by-side.  The default wrapping on such
    devices looks ugly.  Therefore, please limit all lines to a maximum
    of 79 characters. For flowing long blocks of text (docstrings or
    comments), limiting the length to 72 characters is recommended.
    
    Reports error E501.

    Line too long (80 > 79 characters)
    Open

            params = ("sid={}&device=phone1&" "factor={}&out_of_date=False").format(
    Severity: Minor
    Found in aws_okta_keyman/duo.py by pep8

    Limit all lines to a maximum of 79 characters.

    There are still many devices around that are limited to 80 character
    lines; plus, limiting windows to 80 characters makes it possible to
    have several windows side-by-side.  The default wrapping on such
    devices looks ugly.  Therefore, please limit all lines to a maximum
    of 79 characters. For flowing long blocks of text (docstrings or
    comments), limiting the length to 72 characters is recommended.
    
    Reports error E501.

    Line too long (86 > 79 characters)
    Open

            "console_scripts": ["aws_okta_keyman = aws_okta_keyman.__main__:entry_point"],
    Severity: Minor
    Found in setup.py by pep8

    Limit all lines to a maximum of 79 characters.

    There are still many devices around that are limited to 80 character
    lines; plus, limiting windows to 80 characters makes it possible to
    have several windows side-by-side.  The default wrapping on such
    devices looks ugly.  Therefore, please limit all lines to a maximum
    of 79 characters. For flowing long blocks of text (docstrings or
    comments), limiting the length to 72 characters is recommended.
    
    Reports error E501.

    Line too long (86 > 79 characters)
    Open

                i["label"]: i["linkUrl"] for i in resp_obj if i["appName"] == "amazon_aws"
    Severity: Minor
    Found in aws_okta_keyman/okta.py by pep8

    Limit all lines to a maximum of 79 characters.

    There are still many devices around that are limited to 80 character
    lines; plus, limiting windows to 80 characters makes it possible to
    have several windows side-by-side.  The default wrapping on such
    devices looks ugly.  Therefore, please limit all lines to a maximum
    of 79 characters. For flowing long blocks of text (docstrings or
    comments), limiting the length to 72 characters is recommended.
    
    Reports error E501.

    Line too long (85 > 79 characters)
    Open

            params = ("?Action=login&Issuer={}&Destination={}" "&SigninToken={}").format(
    Severity: Minor
    Found in aws_okta_keyman/aws.py by pep8

    Limit all lines to a maximum of 79 characters.

    There are still many devices around that are limited to 80 character
    lines; plus, limiting windows to 80 characters makes it possible to
    have several windows side-by-side.  The default wrapping on such
    devices looks ugly.  Therefore, please limit all lines to a maximum
    of 79 characters. For flowing long blocks of text (docstrings or
    comments), limiting the length to 72 characters is recommended.
    
    Reports error E501.
    Severity
    Category
    Status
    Source
    Language