scalefactory/aws-assume-role

View on GitHub
lib/aws_assume_role/store/shared_config_with_keyring.rb

Summary

Maintainability
C
1 day
Test Coverage

Method assume_role_from_profile has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    def assume_role_from_profile(cfg, profile, opts)
        logger.debug "Entering assume_role_from_profile with #{cfg}, #{profile}, #{opts}"
        prof_cfg = cfg[profile]
        return unless cfg && prof_cfg
        opts[:source_profile] ||= prof_cfg["source_profile"]
Severity: Minor
Found in lib/aws_assume_role/store/shared_config_with_keyring.rb - About 3 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

Method credentials_from_keyring has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def credentials_from_keyring(profile, opts)
        logger.debug "Entering credentials_from_keyring"
        return unless @parsed_config
        logger.debug "credentials_from_keyring: @parsed_config found"
        prof_cfg = @parsed_config[profile]
Severity: Minor
Found in lib/aws_assume_role/store/shared_config_with_keyring.rb - 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

Class SharedConfigWithKeyring has 21 methods (exceeds 20 allowed). Consider refactoring.
Open

class AwsAssumeRole::Store::SharedConfigWithKeyring < AwsAssumeRole::Vendored::Aws::SharedConfig
    include AwsAssumeRole::Store
    include AwsAssumeRole::Logging

    attr_reader :parsed_config
Severity: Minor
Found in lib/aws_assume_role/store/shared_config_with_keyring.rb - About 2 hrs to fix

    Method assume_role_from_profile has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def assume_role_from_profile(cfg, profile, opts)
            logger.debug "Entering assume_role_from_profile with #{cfg}, #{profile}, #{opts}"
            prof_cfg = cfg[profile]
            return unless cfg && prof_cfg
            opts[:source_profile] ||= prof_cfg["source_profile"]
    Severity: Minor
    Found in lib/aws_assume_role/store/shared_config_with_keyring.rb - About 1 hr to fix

      Method mfa_session has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def mfa_session(cfg, profile, opts)
              prof_cfg = cfg[profile]
              return unless cfg && prof_cfg
              opts[:serial_number] ||= opts[:mfa_serial] || prof_cfg["mfa_serial"]
              opts[:source_profile] ||= prof_cfg["source_profile"]
      Severity: Minor
      Found in lib/aws_assume_role/store/shared_config_with_keyring.rb - 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

      Method resolve_parameter has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def resolve_parameter(param, cfg, prof_cfg)
              return unless prof_cfg && cfg
              return prof_cfg[param] if prof_cfg.key? param
              source_profile = prof_cfg["source_profile"]
              return unless source_profile
      Severity: Minor
      Found in lib/aws_assume_role/store/shared_config_with_keyring.rb - 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

      Method fresh has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def fresh(options = {})
              @configuration = nil
              @semaphore = nil
              @assume_role_shared_config = nil
              @profile_name = nil
      Severity: Minor
      Found in lib/aws_assume_role/store/shared_config_with_keyring.rb - 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

      Method initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def initialize(options = {})
              @profile_name = determine_profile(options)
              @config_enabled = options[:config_enabled]
              @credentials_path = options[:credentials_path] ||
                                  determine_credentials_path
      Severity: Minor
      Found in lib/aws_assume_role/store/shared_config_with_keyring.rb - 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

      There are no issues that match your filters.

      Category
      Status