crowbar/crowbar-core

View on GitHub
crowbar_framework/app/controllers/barclamp_controller.rb

Summary

Maintainability
F
1 wk
Test Coverage

File barclamp_controller.rb has 1093 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "chef"
require "json"

class BarclampController < ApplicationController
  wrap_parameters false
Severity: Major
Found in crowbar_framework/app/controllers/barclamp_controller.rb - About 2 days to fix

Method proposal_update has a Cognitive Complexity of 86 (exceeds 5 allowed). Consider refactoring.
Open

  def proposal_update
    if params[:submit].nil?
      #
      # This is RESTFul path
      #
Severity: Minor
Found in crowbar_framework/app/controllers/barclamp_controller.rb - About 1 day 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 proposal_update has 137 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def proposal_update
    if params[:submit].nil?
      #
      # This is RESTFul path
      #
Severity: Major
Found in crowbar_framework/app/controllers/barclamp_controller.rb - About 5 hrs to fix

Method get_proposals_from_barclamps has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

  def get_proposals_from_barclamps(barclamps)
    modules = {}
    active = RoleObject.active
    barclamps.each do |name, details|
      modules[name] = {
Severity: Minor
Found in crowbar_framework/app/controllers/barclamp_controller.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

Class BarclampController has 25 methods (exceeds 20 allowed). Consider refactoring.
Open

class BarclampController < ApplicationController
  wrap_parameters false

  skip_before_filter :enforce_installer, if: proc { Crowbar::Installer.initial_chef_client? }
  skip_before_filter :upgrade, only: [:transition]
Severity: Minor
Found in crowbar_framework/app/controllers/barclamp_controller.rb - About 2 hrs to fix

Method proposal_commit has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def proposal_commit
    code, message = @service_object.proposal_commit(
      params[:id]
    )

Severity: Minor
Found in crowbar_framework/app/controllers/barclamp_controller.rb - About 1 hr to fix

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

  def index
    respond_to do |format|
      format.html {
        @title ||= "#{@bc_name.titlecase} #{t('barclamp.index.members')}"
        @count = -1
Severity: Minor
Found in crowbar_framework/app/controllers/barclamp_controller.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 proposal_create has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def proposal_create
    params[:id] = params[:id] || params[:name]

    begin
      code, message = @service_object.proposal_create(
Severity: Minor
Found in crowbar_framework/app/controllers/barclamp_controller.rb - About 1 hr to fix

Method proposal_status has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def proposal_status
    proposals = {}
    i18n = {}

    begin
Severity: Minor
Found in crowbar_framework/app/controllers/barclamp_controller.rb - About 1 hr to fix

Method get_proposals_from_barclamps has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def get_proposals_from_barclamps(barclamps)
    modules = {}
    active = RoleObject.active
    barclamps.each do |name, details|
      modules[name] = {
Severity: Minor
Found in crowbar_framework/app/controllers/barclamp_controller.rb - About 1 hr to fix

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

  def proposal_show
    code, message = @service_object.proposal_show(
      params[:id]
    )

Severity: Minor
Found in crowbar_framework/app/controllers/barclamp_controller.rb - About 1 hr to fix

Method proposal_reset has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def proposal_reset
    code, message = @service_object.reset_proposal(
      params[:id]
    )

Severity: Minor
Found in crowbar_framework/app/controllers/barclamp_controller.rb - About 1 hr to fix

Method proposal_dequeue has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def proposal_dequeue
    code, message = @service_object.dequeue_proposal(
      params[:id]
    )

Severity: Minor
Found in crowbar_framework/app/controllers/barclamp_controller.rb - About 1 hr to fix

Method proposal_show has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def proposal_show
    code, message = @service_object.proposal_show(
      params[:id]
    )

Severity: Minor
Found in crowbar_framework/app/controllers/barclamp_controller.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 proposal_delete has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def proposal_delete
    code, message = @service_object.proposal_delete(
      params[:id]
    )

Severity: Minor
Found in crowbar_framework/app/controllers/barclamp_controller.rb - About 1 hr to fix

Method transition has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def transition
    id = params[:id]       # Provisioner id
    state = params[:state] # State of node transitioning
    name = params[:name] # Name or alias of node transitioning

Severity: Minor
Found in crowbar_framework/app/controllers/barclamp_controller.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 show has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def show
    ret = @service_object.show_active params[:id]
    @role = ret[1]
    Rails.logger.debug "Role #{ret.inspect}"
    respond_to do |format|
Severity: Minor
Found in crowbar_framework/app/controllers/barclamp_controller.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 delete has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def delete
    params[:id] = params[:id] || params[:name]
    ret = [500, "Server Problem"]
    begin
      ret = @service_object.destroy_active(params[:id])
Severity: Minor
Found in crowbar_framework/app/controllers/barclamp_controller.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

Avoid deeply nested control flow statements.
Open

        rescue StandardError => e
          flash_and_log_exception(e)
Severity: Major
Found in crowbar_framework/app/controllers/barclamp_controller.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

            if unready_nodes.empty? && unallocated_nodes.empty?
              # find out which proposals were not applied yet
              deps = @service_object.proposal_dependencies(
                ServiceObject.proposal_to_role(@proposal, params[:barclamp])
              )
Severity: Major
Found in crowbar_framework/app/controllers/barclamp_controller.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

            unless unallocated_nodes.empty?
              flash[:alert] = t(
                "barclamp.proposal_show.commit_proposal_queued_unallocated",
                nodes: unallocated_nodes.join(", ")
              )
Severity: Major
Found in crowbar_framework/app/controllers/barclamp_controller.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

      elsif params[:submit] == t("barclamp.proposal_show.destroy_active")
        begin
          answer = @service_object.destroy_active(params[:name])
          set_flash(answer, "barclamp.proposal_show.destroy_active_%s")
        rescue StandardError => e
Severity: Major
Found in crowbar_framework/app/controllers/barclamp_controller.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

            unless unready_nodes.empty?
              flash[:notice] = t(
                "barclamp.proposal_show.commit_proposal_queued",
                nodes: (unready_nodes - unallocated_nodes).join(", ")
              )
Severity: Major
Found in crowbar_framework/app/controllers/barclamp_controller.rb - About 45 mins to fix

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

  def proposal_status
    proposals = {}
    i18n = {}

    begin
Severity: Minor
Found in crowbar_framework/app/controllers/barclamp_controller.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

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

  def proposal_reset
    code, message = @service_object.reset_proposal(
      params[:id]
    )

Severity: Major
Found in crowbar_framework/app/controllers/barclamp_controller.rb and 1 other location - About 2 hrs to fix
crowbar_framework/app/controllers/barclamp_controller.rb on lines 816..849

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

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 proposal_dequeue
    code, message = @service_object.dequeue_proposal(
      params[:id]
    )

Severity: Major
Found in crowbar_framework/app/controllers/barclamp_controller.rb and 1 other location - About 2 hrs to fix
crowbar_framework/app/controllers/barclamp_controller.rb on lines 772..805

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

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

      format.json {
        ret = @service_object.list_active
        @roles = ret[1]
        return render text: @roles, status: ret[0] if ret[0] != 200
        render json: @roles
Severity: Minor
Found in crowbar_framework/app/controllers/barclamp_controller.rb and 1 other location - About 25 mins to fix
crowbar_framework/app/controllers/barclamp_controller.rb on lines 338..343

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

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

      format.xml  {
        ret = @service_object.list_active
        @roles = ret[1]
        return render text: @roles, status: ret[0] if ret[0] != 200
        render xml: @roles
Severity: Minor
Found in crowbar_framework/app/controllers/barclamp_controller.rb and 1 other location - About 25 mins to fix
crowbar_framework/app/controllers/barclamp_controller.rb on lines 344..349

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

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 versions
    ret = @service_object.versions
    return render text: ret[1], status: ret[0] if ret[0] != 200
    render json: ret[1]
  end
Severity: Minor
Found in crowbar_framework/app/controllers/barclamp_controller.rb and 1 other location - About 20 mins to fix
crowbar_framework/app/controllers/barclamp_controller.rb on lines 290..294

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

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

  def elements
    ret = @service_object.elements
    return render text: ret[1], status: ret[0] if ret[0] != 200
    render json: ret[1]
  end
Severity: Minor
Found in crowbar_framework/app/controllers/barclamp_controller.rb and 1 other location - About 20 mins to fix
crowbar_framework/app/controllers/barclamp_controller.rb on lines 98..102

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

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

      format.json {
        return render text: ret[1], status: ret[0] if ret[0] != 200
        render json: {}
      }
Severity: Minor
Found in crowbar_framework/app/controllers/barclamp_controller.rb and 1 other location - About 15 mins to fix
crowbar_framework/app/controllers/barclamp_controller.rb on lines 268..271

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

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

      format.xml  {
        return render text: @role, status: ret[0] if ret[0] != 200
        render xml: role_to_proposal(@role, @bc_name)
      }
Severity: Minor
Found in crowbar_framework/app/controllers/barclamp_controller.rb and 1 other location - About 15 mins to fix
crowbar_framework/app/controllers/barclamp_controller.rb on lines 239..242

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

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

      format.json {
        return render text: @role, status: ret[0] if ret[0] != 200
        render json: role_to_proposal(@role, @bc_name)
      }
Severity: Minor
Found in crowbar_framework/app/controllers/barclamp_controller.rb and 1 other location - About 15 mins to fix
crowbar_framework/app/controllers/barclamp_controller.rb on lines 234..237

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

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

      format.xml  {
        return render text: ret[1], status: ret[0] if ret[0] != 200
        render xml: {}
      }
Severity: Minor
Found in crowbar_framework/app/controllers/barclamp_controller.rb and 1 other location - About 15 mins to fix
crowbar_framework/app/controllers/barclamp_controller.rb on lines 272..275

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

There are no issues that match your filters.

Category
Status