ashrithr/awscli

View on GitHub
lib/awscli/cli/ec2/instances.rb

Summary

Maintainability
B
5 hrs
Test Coverage

File instances.rb has 270 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module AwsCli
  module CLI
    module EC2
      require 'awscli/cli/ec2'
      require 'awscli/helper'
Severity: Minor
Found in lib/awscli/cli/ec2/instances.rb - About 2 hrs to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            def create_centos
              create_ec2_object
              centos_amis    = {
                  'us-east-1'       => 'ami-a96b01c0',  #Virginia
                  'us-west-1'       => 'ami-51351b14',  #Northern California
    Severity: Major
    Found in lib/awscli/cli/ec2/instances.rb and 1 other location - About 1 hr to fix
    lib/awscli/cli/ec2/instances.rb on lines 233..254

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 57.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            def create_ubuntu
              create_ec2_object
              ubuntu_amis    = {
                  'us-east-1'       => 'ami-9b85eef2',  #Virginia
                  'us-west-1'       => 'ami-9b2d03de',  #Northern California
    Severity: Major
    Found in lib/awscli/cli/ec2/instances.rb and 1 other location - About 1 hr to fix
    lib/awscli/cli/ec2/instances.rb on lines 204..224

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 57.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 21 locations. Consider refactoring.
    Open

            def create_ec2_object
              puts "ec2 Establishing Connetion..."
              $ec2_conn = if parent_options[:region]
                            Awscli::Connection.new.request_ec2(parent_options[:region])
                          else
    Severity: Major
    Found in lib/awscli/cli/ec2/instances.rb and 20 other locations - About 20 mins to fix
    lib/awscli/cli/dynamo/item.rb on lines 260..268
    lib/awscli/cli/dynamo/table.rb on lines 68..76
    lib/awscli/cli/ec2/ami.rb on lines 45..53
    lib/awscli/cli/ec2/ebs.rb on lines 79..87
    lib/awscli/cli/ec2/eip.rb on lines 44..52
    lib/awscli/cli/ec2/keypairs.rb on lines 48..56
    lib/awscli/cli/ec2/monitoring.rb on lines 23..31
    lib/awscli/cli/ec2/placement.rb on lines 30..38
    lib/awscli/cli/ec2/reservedinstmng.rb on lines 33..41
    lib/awscli/cli/ec2/secgroups.rb on lines 54..62
    lib/awscli/cli/ec2/spot.rb on lines 69..77
    lib/awscli/cli/ec2/tags.rb on lines 33..41
    lib/awscli/cli/ec2/vpc.rb on lines 30..38
    lib/awscli/cli/ec2/vpc/dhcp.rb on lines 38..46
    lib/awscli/cli/ec2/vpc/internet_gateways.rb on lines 45..53
    lib/awscli/cli/ec2/vpc/net_interfaces.rb on lines 62..70
    lib/awscli/cli/ec2/vpc/network_acls.rb on lines 16..24
    lib/awscli/cli/ec2/vpc/route_tables.rb on lines 69..77
    lib/awscli/cli/ec2/vpc/subnet.rb on lines 32..40
    lib/awscli/cli/s3/files.rb on lines 91..99

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 28.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    There are no issues that match your filters.

    Category
    Status