scalefactory/aws-assume-role

View on GitHub

Showing 17 of 24 total issues

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

Method resolve_credentials has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def resolve_credentials(type, break_if_successful = false, explicit_default_profile = false)
        factories_to_try = Repository.factories[type]
        factories_to_try.each do |x|
            options = to_h
            options[:credentials] = credentials if credentials && credentials.set?
Severity: Minor
Found in lib/aws_assume_role/credentials/factories/default_chain_provider.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 a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

            def assume_role_from_profile(cfg, profile, opts)
                if cfg && prof_cfg = cfg[profile]
                    opts[:source_profile] ||= prof_cfg["source_profile"]
                    if opts[:source_profile]
                        opts[:credentials] = credentials(profile: opts[:source_profile])
    Severity: Minor
    Found in lib/aws_assume_role/vendored/aws/shared_config.rb - 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

    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 initialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def initialize(options = {})
              client_opts = {}
              @assume_role_params = {}
              options.each_pair do |key, value|
                  if self.class.assume_role_options.include?(key)
      Severity: Minor
      Found in lib/aws_assume_role/credentials/providers/assume_role_credentials.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 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 initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def initialize(options = {})
              logger.debug "SharedKeyringCredentials initiated with #{options}"
              @path = options[:path]
              @path ||= AwsAssumeRole.shared_config.credentials_path
              @profile_name = options[:profile_name] ||= options[:profile]
      Severity: Minor
      Found in lib/aws_assume_role/credentials/providers/shared_keyring_credentials.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 validate_profile_exists has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

              def validate_profile_exists(profile)
                  unless (@parsed_credentials && @parsed_credentials[profile]) ||
                         (@parsed_config && @parsed_config[profile])
                      msg = "Profile `#{profile}' not found in #{@credentials_path}"
                      msg << " or #{@config_path}" if @config_path
      Severity: Minor
      Found in lib/aws_assume_role/vendored/aws/shared_config.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 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 region has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

              def region(opts = {})
                  p = opts[:profile] || @profile_name
                  if @config_enabled
                      if @parsed_credentials
                          region = @parsed_credentials.fetch(p, {})["region"]
      Severity: Minor
      Found in lib/aws_assume_role/vendored/aws/shared_config.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 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def initialize(options)
              logger.debug "AwsAssumeRole::Credentials::Factories::AssumeRole initiated with #{options}"
              return unless options[:profile] || options[:role_arn]
              if options[:profile]
                  logger.debug "AwsAssumeRole: #{options[:profile]} found. Trying with profile"
      Severity: Minor
      Found in lib/aws_assume_role/credentials/factories/assume_role.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 fresh has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

              def fresh(options = {})
                  @profile_name = nil
                  @credentials_path = nil
                  @config_path = nil
                  @parsed_credentials = {}
      Severity: Minor
      Found in lib/aws_assume_role/vendored/aws/shared_config.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

      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/vendored/aws/shared_config.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

      Severity
      Category
      Status
      Source
      Language