Cimpress-MCP/LambdaWrap

View on GitHub
lib/lambda_wrap/api_manager.rb

Summary

Maintainability
C
1 day
Test Coverage

Method delete has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def delete
      if dynamo_tables.empty? && lambdas.empty? && api_gateways.empty?
        puts 'Nothing to Deleting.'
        return
      end
Severity: Minor
Found in lib/lambda_wrap/api_manager.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

Consider simplifying this complex logical expression.
Open

      unless options[:lambda_client] && options[:dynamo_client] && options[:api_gateway_client]
        access_key_id = options[:access_key_id] || ENV['AWS_ACCESS_KEY_ID'] || ENV['ACCESS_KEY'] ||
                        raise(ArgumentError, 'Cannot find AWS Access Key ID.')

        secret_access_key = options[:secret_access_key] || ENV['AWS_SECRET_ACCESS_KEY'] || ENV['SECRET_KEY'] ||
Severity: Critical
Found in lib/lambda_wrap/api_manager.rb - About 1 hr to fix

    Method deploy has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def deploy(environment_options)
          environment_parameter_guard(environment_options)
          if no_op?
            puts 'Nothing to deploy.'
            return
    Severity: Minor
    Found in lib/lambda_wrap/api_manager.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 teardown has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def teardown(environment_options)
          environment_parameter_guard(environment_options)
          if no_op?
            puts 'Nothing to teardown.'
            return
    Severity: Minor
    Found in lib/lambda_wrap/api_manager.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 deploy has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def deploy(environment_options)
          environment_parameter_guard(environment_options)
          if no_op?
            puts 'Nothing to deploy.'
            return
    Severity: Minor
    Found in lib/lambda_wrap/api_manager.rb - About 1 hr to fix

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

          def teardown(environment_options)
            environment_parameter_guard(environment_options)
            if no_op?
              puts 'Nothing to teardown.'
              return
      Severity: Minor
      Found in lib/lambda_wrap/api_manager.rb - About 1 hr to fix

        Method delete has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def delete
              if dynamo_tables.empty? && lambdas.empty? && api_gateways.empty?
                puts 'Nothing to Deleting.'
                return
              end
        Severity: Minor
        Found in lib/lambda_wrap/api_manager.rb - About 1 hr to fix

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

              def initialize(options = {})
                unless options[:lambda_client] && options[:dynamo_client] && options[:api_gateway_client]
                  access_key_id = options[:access_key_id] || ENV['AWS_ACCESS_KEY_ID'] || ENV['ACCESS_KEY'] ||
                                  raise(ArgumentError, 'Cannot find AWS Access Key ID.')
          
          
          Severity: Minor
          Found in lib/lambda_wrap/api_manager.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