ClusterLabs/hawk

View on GitHub

Showing 238 of 2,376 total issues

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

  def set_record
    @primitive = Template.find params[:id]

    unless @primitive
      respond_to do |format|
Severity: Major
Found in hawk/app/controllers/templates_controller.rb and 11 other locations - About 20 mins to fix
hawk/app/controllers/alerts_controller.rb on lines 144..151
hawk/app/controllers/clones_controller.rb on lines 144..151
hawk/app/controllers/colocations_controller.rb on lines 142..149
hawk/app/controllers/groups_controller.rb on lines 144..151
hawk/app/controllers/locations_controller.rb on lines 162..169
hawk/app/controllers/orders_controller.rb on lines 144..151
hawk/app/controllers/primitives_controller.rb on lines 173..180
hawk/app/controllers/roles_controller.rb on lines 143..150
hawk/app/controllers/tags_controller.rb on lines 140..147
hawk/app/controllers/tickets_controller.rb on lines 193..200
hawk/app/controllers/users_controller.rb on lines 145..152

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 12 locations. Consider refactoring.
Open

  def set_record
    @location = Location.find params[:id]

    unless @location
      respond_to do |format|
Severity: Major
Found in hawk/app/controllers/locations_controller.rb and 11 other locations - About 20 mins to fix
hawk/app/controllers/alerts_controller.rb on lines 144..151
hawk/app/controllers/clones_controller.rb on lines 144..151
hawk/app/controllers/colocations_controller.rb on lines 142..149
hawk/app/controllers/groups_controller.rb on lines 144..151
hawk/app/controllers/orders_controller.rb on lines 144..151
hawk/app/controllers/primitives_controller.rb on lines 173..180
hawk/app/controllers/roles_controller.rb on lines 143..150
hawk/app/controllers/tags_controller.rb on lines 140..147
hawk/app/controllers/templates_controller.rb on lines 161..168
hawk/app/controllers/tickets_controller.rb on lines 193..200
hawk/app/controllers/users_controller.rb on lines 145..152

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 12 locations. Consider refactoring.
Open

  def set_record
    @primitive = Primitive.find params[:id]

    unless @primitive
      respond_to do |format|
Severity: Major
Found in hawk/app/controllers/primitives_controller.rb and 11 other locations - About 20 mins to fix
hawk/app/controllers/alerts_controller.rb on lines 144..151
hawk/app/controllers/clones_controller.rb on lines 144..151
hawk/app/controllers/colocations_controller.rb on lines 142..149
hawk/app/controllers/groups_controller.rb on lines 144..151
hawk/app/controllers/locations_controller.rb on lines 162..169
hawk/app/controllers/orders_controller.rb on lines 144..151
hawk/app/controllers/roles_controller.rb on lines 143..150
hawk/app/controllers/tags_controller.rb on lines 140..147
hawk/app/controllers/templates_controller.rb on lines 161..168
hawk/app/controllers/tickets_controller.rb on lines 193..200
hawk/app/controllers/users_controller.rb on lines 145..152

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 12 locations. Consider refactoring.
Open

  def set_record
    @colocation = Colocation.find params[:id]

    unless @colocation
      respond_to do |format|
Severity: Major
Found in hawk/app/controllers/colocations_controller.rb and 11 other locations - About 20 mins to fix
hawk/app/controllers/alerts_controller.rb on lines 144..151
hawk/app/controllers/clones_controller.rb on lines 144..151
hawk/app/controllers/groups_controller.rb on lines 144..151
hawk/app/controllers/locations_controller.rb on lines 162..169
hawk/app/controllers/orders_controller.rb on lines 144..151
hawk/app/controllers/primitives_controller.rb on lines 173..180
hawk/app/controllers/roles_controller.rb on lines 143..150
hawk/app/controllers/tags_controller.rb on lines 140..147
hawk/app/controllers/templates_controller.rb on lines 161..168
hawk/app/controllers/tickets_controller.rb on lines 193..200
hawk/app/controllers/users_controller.rb on lines 145..152

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 12 locations. Consider refactoring.
Open

  def set_record
    @user = User.find params[:id]

    unless @user
      respond_to do |format|
Severity: Major
Found in hawk/app/controllers/users_controller.rb and 11 other locations - About 20 mins to fix
hawk/app/controllers/alerts_controller.rb on lines 144..151
hawk/app/controllers/clones_controller.rb on lines 144..151
hawk/app/controllers/colocations_controller.rb on lines 142..149
hawk/app/controllers/groups_controller.rb on lines 144..151
hawk/app/controllers/locations_controller.rb on lines 162..169
hawk/app/controllers/orders_controller.rb on lines 144..151
hawk/app/controllers/primitives_controller.rb on lines 173..180
hawk/app/controllers/roles_controller.rb on lines 143..150
hawk/app/controllers/tags_controller.rb on lines 140..147
hawk/app/controllers/templates_controller.rb on lines 161..168
hawk/app/controllers/tickets_controller.rb on lines 193..200

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 12 locations. Consider refactoring.
Open

  def set_record
    @role = Role.find params[:id]

    unless @role
      respond_to do |format|
Severity: Major
Found in hawk/app/controllers/roles_controller.rb and 11 other locations - About 20 mins to fix
hawk/app/controllers/alerts_controller.rb on lines 144..151
hawk/app/controllers/clones_controller.rb on lines 144..151
hawk/app/controllers/colocations_controller.rb on lines 142..149
hawk/app/controllers/groups_controller.rb on lines 144..151
hawk/app/controllers/locations_controller.rb on lines 162..169
hawk/app/controllers/orders_controller.rb on lines 144..151
hawk/app/controllers/primitives_controller.rb on lines 173..180
hawk/app/controllers/tags_controller.rb on lines 140..147
hawk/app/controllers/templates_controller.rb on lines 161..168
hawk/app/controllers/tickets_controller.rb on lines 193..200
hawk/app/controllers/users_controller.rb on lines 145..152

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 12 locations. Consider refactoring.
Open

  def set_record
    @ticket = Ticket.find params[:id]

    unless @ticket
      respond_to do |format|
Severity: Major
Found in hawk/app/controllers/tickets_controller.rb and 11 other locations - About 20 mins to fix
hawk/app/controllers/alerts_controller.rb on lines 144..151
hawk/app/controllers/clones_controller.rb on lines 144..151
hawk/app/controllers/colocations_controller.rb on lines 142..149
hawk/app/controllers/groups_controller.rb on lines 144..151
hawk/app/controllers/locations_controller.rb on lines 162..169
hawk/app/controllers/orders_controller.rb on lines 144..151
hawk/app/controllers/primitives_controller.rb on lines 173..180
hawk/app/controllers/roles_controller.rb on lines 143..150
hawk/app/controllers/tags_controller.rb on lines 140..147
hawk/app/controllers/templates_controller.rb on lines 161..168
hawk/app/controllers/users_controller.rb on lines 145..152

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 12 locations. Consider refactoring.
Open

  def set_record
    @order = Order.find params[:id]

    unless @order
      respond_to do |format|
Severity: Major
Found in hawk/app/controllers/orders_controller.rb and 11 other locations - About 20 mins to fix
hawk/app/controllers/alerts_controller.rb on lines 144..151
hawk/app/controllers/clones_controller.rb on lines 144..151
hawk/app/controllers/colocations_controller.rb on lines 142..149
hawk/app/controllers/groups_controller.rb on lines 144..151
hawk/app/controllers/locations_controller.rb on lines 162..169
hawk/app/controllers/primitives_controller.rb on lines 173..180
hawk/app/controllers/roles_controller.rb on lines 143..150
hawk/app/controllers/tags_controller.rb on lines 140..147
hawk/app/controllers/templates_controller.rb on lines 161..168
hawk/app/controllers/tickets_controller.rb on lines 193..200
hawk/app/controllers/users_controller.rb on lines 145..152

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 12 locations. Consider refactoring.
Open

  def set_record
    @clone = Clone.find params[:id]

    unless @clone
      respond_to do |format|
Severity: Major
Found in hawk/app/controllers/clones_controller.rb and 11 other locations - About 20 mins to fix
hawk/app/controllers/alerts_controller.rb on lines 144..151
hawk/app/controllers/colocations_controller.rb on lines 142..149
hawk/app/controllers/groups_controller.rb on lines 144..151
hawk/app/controllers/locations_controller.rb on lines 162..169
hawk/app/controllers/orders_controller.rb on lines 144..151
hawk/app/controllers/primitives_controller.rb on lines 173..180
hawk/app/controllers/roles_controller.rb on lines 143..150
hawk/app/controllers/tags_controller.rb on lines 140..147
hawk/app/controllers/templates_controller.rb on lines 161..168
hawk/app/controllers/tickets_controller.rb on lines 193..200
hawk/app/controllers/users_controller.rb on lines 145..152

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 12 locations. Consider refactoring.
Open

  def set_record
    @tag = Tag.find params[:id]

    unless @tag
      respond_to do |format|
Severity: Major
Found in hawk/app/controllers/tags_controller.rb and 11 other locations - About 20 mins to fix
hawk/app/controllers/alerts_controller.rb on lines 144..151
hawk/app/controllers/clones_controller.rb on lines 144..151
hawk/app/controllers/colocations_controller.rb on lines 142..149
hawk/app/controllers/groups_controller.rb on lines 144..151
hawk/app/controllers/locations_controller.rb on lines 162..169
hawk/app/controllers/orders_controller.rb on lines 144..151
hawk/app/controllers/primitives_controller.rb on lines 173..180
hawk/app/controllers/roles_controller.rb on lines 143..150
hawk/app/controllers/templates_controller.rb on lines 161..168
hawk/app/controllers/tickets_controller.rb on lines 193..200
hawk/app/controllers/users_controller.rb on lines 145..152

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 12 locations. Consider refactoring.
Open

  def set_record
    @alert = Alert.find params[:id]

    unless @alert
      respond_to do |format|
Severity: Major
Found in hawk/app/controllers/alerts_controller.rb and 11 other locations - About 20 mins to fix
hawk/app/controllers/clones_controller.rb on lines 144..151
hawk/app/controllers/colocations_controller.rb on lines 142..149
hawk/app/controllers/groups_controller.rb on lines 144..151
hawk/app/controllers/locations_controller.rb on lines 162..169
hawk/app/controllers/orders_controller.rb on lines 144..151
hawk/app/controllers/primitives_controller.rb on lines 173..180
hawk/app/controllers/roles_controller.rb on lines 143..150
hawk/app/controllers/tags_controller.rb on lines 140..147
hawk/app/controllers/templates_controller.rb on lines 161..168
hawk/app/controllers/tickets_controller.rb on lines 193..200
hawk/app/controllers/users_controller.rb on lines 145..152

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 12 locations. Consider refactoring.
Open

  def set_record
    @group = Group.find params[:id]

    unless @group
      respond_to do |format|
Severity: Major
Found in hawk/app/controllers/groups_controller.rb and 11 other locations - About 20 mins to fix
hawk/app/controllers/alerts_controller.rb on lines 144..151
hawk/app/controllers/clones_controller.rb on lines 144..151
hawk/app/controllers/colocations_controller.rb on lines 142..149
hawk/app/controllers/locations_controller.rb on lines 162..169
hawk/app/controllers/orders_controller.rb on lines 144..151
hawk/app/controllers/primitives_controller.rb on lines 173..180
hawk/app/controllers/roles_controller.rb on lines 143..150
hawk/app/controllers/tags_controller.rb on lines 140..147
hawk/app/controllers/templates_controller.rb on lines 161..168
hawk/app/controllers/tickets_controller.rb on lines 193..200
hawk/app/controllers/users_controller.rb on lines 145..152

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 3 locations. Consider refactoring.
Open

  def available_ticket_resources
    [
      @cib.resources.map{|x| x[:id]},
      @cib.templates.map{|x| x[:id]}
    ].flatten.sort do |a, b|
Severity: Minor
Found in hawk/app/helpers/ticket_helper.rb and 2 other locations - About 20 mins to fix
hawk/app/helpers/colocation_helper.rb on lines 14..19
hawk/app/helpers/order_helper.rb on lines 14..19

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

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

  rescue ArgumentError => e
    respond_to do |format|
      format.json do
        render json: { errors: [e.message] }, status: :not_found
      end
Severity: Minor
Found in hawk/app/controllers/cib_controller.rb and 5 other locations - About 20 mins to fix
hawk/app/controllers/cib_controller.rb on lines 25..39
hawk/app/controllers/cib_controller.rb on lines 32..39
hawk/app/controllers/configs_controller.rb on lines 39..60
hawk/app/controllers/configs_controller.rb on lines 46..60
hawk/app/controllers/configs_controller.rb on lines 53..60

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

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

  rescue SecurityError => e
    respond_to do |format|
      format.json do
        render json: { errors: [e.message] }, status: :forbidden
      end
Severity: Minor
Found in hawk/app/controllers/cib_controller.rb and 5 other locations - About 20 mins to fix
hawk/app/controllers/cib_controller.rb on lines 18..39
hawk/app/controllers/cib_controller.rb on lines 32..39
hawk/app/controllers/configs_controller.rb on lines 39..60
hawk/app/controllers/configs_controller.rb on lines 46..60
hawk/app/controllers/configs_controller.rb on lines 53..60

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

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

  def available_colocation_resources
    [
      @cib.resources.map{|x| x[:id]},
      @cib.templates.map{|x| x[:id]}
    ].flatten.sort do |a, b|
Severity: Minor
Found in hawk/app/helpers/colocation_helper.rb and 2 other locations - About 20 mins to fix
hawk/app/helpers/order_helper.rb on lines 14..19
hawk/app/helpers/ticket_helper.rb on lines 26..31

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

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

  def available_order_resources
    [
      @cib.resources.map{|x| x[:id]},
      @cib.templates.map{|x| x[:id]}
    ].flatten.sort do |a, b|
Severity: Minor
Found in hawk/app/helpers/order_helper.rb and 2 other locations - About 20 mins to fix
hawk/app/helpers/colocation_helper.rb on lines 14..19
hawk/app/helpers/ticket_helper.rb on lines 26..31

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

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

  rescue RuntimeError => e
    respond_to do |format|
      format.json do
        render json: { errors: [e.message] }, status: :internal_server_error
      end
Severity: Minor
Found in hawk/app/controllers/cib_controller.rb and 5 other locations - About 20 mins to fix
hawk/app/controllers/cib_controller.rb on lines 18..39
hawk/app/controllers/cib_controller.rb on lines 25..39
hawk/app/controllers/configs_controller.rb on lines 39..60
hawk/app/controllers/configs_controller.rb on lines 46..60
hawk/app/controllers/configs_controller.rb on lines 53..60

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

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

  rescue ArgumentError => e
    respond_to do |format|
      format.json do
        render json: { errors: [e.message] }, status: :not_found
      end
Severity: Minor
Found in hawk/app/controllers/configs_controller.rb and 5 other locations - About 20 mins to fix
hawk/app/controllers/cib_controller.rb on lines 18..39
hawk/app/controllers/cib_controller.rb on lines 25..39
hawk/app/controllers/cib_controller.rb on lines 32..39
hawk/app/controllers/configs_controller.rb on lines 46..60
hawk/app/controllers/configs_controller.rb on lines 53..60

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

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

  rescue RuntimeError => e
    respond_to do |format|
      format.json do
        render json: { errors: [e.message] }, status: :internal_server_error
      end
Severity: Minor
Found in hawk/app/controllers/configs_controller.rb and 5 other locations - About 20 mins to fix
hawk/app/controllers/cib_controller.rb on lines 18..39
hawk/app/controllers/cib_controller.rb on lines 25..39
hawk/app/controllers/cib_controller.rb on lines 32..39
hawk/app/controllers/configs_controller.rb on lines 39..60
hawk/app/controllers/configs_controller.rb on lines 46..60

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

Severity
Category
Status
Source
Language