Cimpress-MCP/LambdaWrap

View on GitHub
lib/lambda_wrap/api_gateway_manager.rb

Summary

Maintainability
A
2 hrs
Test Coverage

Method deploy has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def deploy(environment_options, client, region = 'AWS_REGION')
      super
      puts "Deploying API: #{@api_name} to Environment: #{environment_options.name}"
      @stage_variables = environment_options.variables || {}
      @stage_variables.store('environment', environment_options.name)
Severity: Minor
Found in lib/lambda_wrap/api_gateway_manager.rb - About 1 hr to fix

    Method get_id_for_api has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_id_for_api(api_name)
          response = nil
          loop do
            options = {
              limit: 500
    Severity: Minor
    Found in lib/lambda_wrap/api_gateway_manager.rb - About 45 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 deploy has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def deploy(environment_options, client, region = 'AWS_REGION')
          super
          puts "Deploying API: #{@api_name} to Environment: #{environment_options.name}"
          @stage_variables = environment_options.variables || {}
          @stage_variables.store('environment', environment_options.name)
    Severity: Minor
    Found in lib/lambda_wrap/api_gateway_manager.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 extract_specification has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def extract_specification(file_path)
          raise ArgumentError, "Open API Spec (Swagger) File does not exist: #{file_path}!" unless File.exist?(file_path)
          spec = Psych.load_file(file_path)
          raise ArgumentError, 'LambdaWrap only supports swagger v2.0' unless spec['swagger'] == '2.0'
          raise ArgumentError, 'Invalid Title field in the OAPISpec' unless spec['info']['title'] =~ /[A-Za-z0-9]{1,1024}/
    Severity: Minor
    Found in lib/lambda_wrap/api_gateway_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