cloudamatic/mu

View on GitHub
modules/mu/providers/cloudformation/cache_cluster.rb

Summary

Maintainability
A
2 hrs
Test Coverage

Assignment Branch Condition size for create is too high. [131.5/75]
Open

        def create
          @config['identifier'] = @mu_name

          sg_param_name = nil
          if @config["create_replication_group"]

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

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

              @config['vpc']['subnets'].each { |subnet|
                if !subnet["subnet_id"].nil?
                  MU::Cloud::CloudFormation.setCloudFormationProp(subnets_template[subnets_name], "SubnetIds", subnet["subnet_id"])
                elsif @dependencies.has_key?("vpc") and @dependencies["vpc"].has_key?(@config["vpc"]["vpc_name"])
                  @dependencies["vpc"][@config["vpc"]["vpc_name"]].subnets.each { |subnet_obj|
Severity: Major
Found in modules/mu/providers/cloudformation/cache_cluster.rb and 1 other location - About 2 hrs to fix
modules/mu/providers/cloudformation/database.rb on lines 159..169

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 82.

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

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

            @mu_name ||=
              if @config["create_replication_group"]
                @deploy.getResourceName(@config["name"], max_length: 16, need_unique_string: true)
              else
                @deploy.getResourceName(@config["name"], max_length: 20, need_unique_string: true)
Severity: Minor
Found in modules/mu/providers/cloudformation/cache_cluster.rb and 1 other location - About 20 mins to fix
modules/mu/providers/aws/cache_cluster.rb on lines 25..32

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 27.

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

Identical blocks of code found in 7 locations. Consider refactoring.
Open

            @cfm_name, @cfm_template = MU::Cloud::CloudFormation.cloudFormationBase(self.class.cfg_name, self, tags: @config['tags'], scrub_mu_isms: @config['scrub_mu_isms']) if @cfm_template.nil?
Severity: Minor
Found in modules/mu/providers/cloudformation/cache_cluster.rb and 6 other locations - About 15 mins to fix
modules/mu/providers/cloudformation/database.rb on lines 74..74
modules/mu/providers/cloudformation/firewall_rule.rb on lines 56..56
modules/mu/providers/cloudformation/loadbalancer.rb on lines 49..49
modules/mu/providers/cloudformation/server.rb on lines 85..85
modules/mu/providers/cloudformation/server_pool.rb on lines 48..48
modules/mu/providers/cloudformation/vpc.rb on lines 52..52

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 25.

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

Unused method argument - args. If it's necessary, use _ or _args as an argument name to indicate that it won't be used. You can also write as find(*) if you want the method to accept any arguments but don't care about them.
Open

        def self.find(*args)

This cop checks for unused method arguments.

Example:

# bad

def some_method(used, unused, _unused_but_allowed)
  puts used
end

Example:

# good

def some_method(used, _unused, _unused_but_allowed)
  puts used
end

Unused method argument - args. If it's necessary, use _ or _args as an argument name to indicate that it won't be used. You can also write as cleanup(*) if you want the method to accept any arguments but don't care about them.
Open

        def self.cleanup(*args)

This cop checks for unused method arguments.

Example:

# bad

def some_method(used, unused, _unused_but_allowed)
  puts used
end

Example:

# good

def some_method(used, _unused, _unused_but_allowed)
  puts used
end

There are no issues that match your filters.

Category
Status