axsh/wakame-vdc

View on GitHub
frontend/dcmgr_gui/app/controllers/vdc_management_dialog_controller.rb

Summary

Maintainability
F
4 days
Test Coverage

File vdc_management_dialog_controller.rb has 398 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "yaml"

class VdcManagementDialogController < ApplicationController
  layout false
  before_filter :system_manager?

Class VdcManagementDialogController has 27 methods (exceeds 20 allowed). Consider refactoring.
Open

class VdcManagementDialogController < ApplicationController
  layout false
  before_filter :system_manager?

  def create_hostnode

Method get_is_drives_list has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def get_is_drives_list  
    catch_error do
      if params[:uuid] != "" and params[:uuid] != nil then
        # カレントのグループが、指定グループでない場合、HTTPヘッダのグループを変更
        user = User.sel(@current_user.uuid)

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 get_is_vifs_list has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  def get_is_vifs_list  
    catch_error do
      if params[:uuid] != "" and params[:uuid] != nil then
        # カレントのグループが、指定グループでない場合、HTTPヘッダのグループを変更
        user = User.sel(@current_user.uuid)

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 get_is_drives_list has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def get_is_drives_list  
    catch_error do
      if params[:uuid] != "" and params[:uuid] != nil then
        # カレントのグループが、指定グループでない場合、HTTPヘッダのグループを変更
        user = User.sel(@current_user.uuid)

Method get_is_vifs_list has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def get_is_vifs_list  
    catch_error do
      if params[:uuid] != "" and params[:uuid] != nil then
        # カレントのグループが、指定グループでない場合、HTTPヘッダのグループを変更
        user = User.sel(@current_user.uuid)

Method is_drive_change has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def is_drive_change
    oper = params[:oper]
    case oper
    # 作成処理
    when "add"

Method is_vif_change has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def is_vif_change
    oper = params[:oper]
    case oper
    when "add"
      # 作成の場合

Method is_drive_change has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def is_drive_change
    oper = params[:oper]
    case oper
    # 作成処理
    when "add"
Severity: Minor
Found in frontend/dcmgr_gui/app/controllers/vdc_management_dialog_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 is_vif_change has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def is_vif_change
    oper = params[:oper]
    case oper
    when "add"
      # 作成の場合
Severity: Minor
Found in frontend/dcmgr_gui/app/controllers/vdc_management_dialog_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

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

  def get_is_list
    catch_error do
      # カレントのグループが、指定グループでない場合、HTTPヘッダのグループを変更
      user = User.sel(@current_user.uuid)
      save_account_uuid = "a-%s" % user[:primary_account_id]
frontend/dcmgr_gui/app/controllers/vdc_management_dialog_controller.rb on lines 39..65
frontend/dcmgr_gui/app/controllers/vdc_management_dialog_controller.rb on lines 121..147
frontend/dcmgr_gui/app/controllers/vdc_management_dialog_controller.rb on lines 512..537

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

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

  def get_hn_list
    catch_error do
      # カレントのグループが、指定グループでない場合、HTTPヘッダのグループを変更
      user = User.sel(@current_user.uuid)
      save_account_uuid = "a-%s" % user[:primary_account_id]
frontend/dcmgr_gui/app/controllers/vdc_management_dialog_controller.rb on lines 121..147
frontend/dcmgr_gui/app/controllers/vdc_management_dialog_controller.rb on lines 187..213
frontend/dcmgr_gui/app/controllers/vdc_management_dialog_controller.rb on lines 512..537

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

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

  def get_wmi_list
    catch_error do
      # カレントのグループが、指定グループでない場合、HTTPヘッダのグループを変更
      user = User.sel(@current_user.uuid)
      save_account_uuid = "a-%s" % user[:primary_account_id]
frontend/dcmgr_gui/app/controllers/vdc_management_dialog_controller.rb on lines 39..65
frontend/dcmgr_gui/app/controllers/vdc_management_dialog_controller.rb on lines 121..147
frontend/dcmgr_gui/app/controllers/vdc_management_dialog_controller.rb on lines 187..213

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

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

  def get_sn_list
    catch_error do
      # カレントのグループが、指定グループでない場合、HTTPヘッダのグループを変更
      user = User.sel(@current_user.uuid)
      save_account_uuid = "a-%s" % user[:primary_account_id]
frontend/dcmgr_gui/app/controllers/vdc_management_dialog_controller.rb on lines 39..65
frontend/dcmgr_gui/app/controllers/vdc_management_dialog_controller.rb on lines 187..213
frontend/dcmgr_gui/app/controllers/vdc_management_dialog_controller.rb on lines 512..537

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

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

    when "add"
      # 作成の場合
      data = Hash.new
      if params[:bandwidth] != "" then
        data.store("bandwidth",params[:bandwidth])
frontend/dcmgr_gui/app/controllers/vdc_management_dialog_controller.rb on lines 391..403
frontend/dcmgr_gui/app/controllers/vdc_management_dialog_controller.rb on lines 430..444

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

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

    when "edit"
      data = Hash.new
      if params[:drive_size] != "" then
        data.store("size",params[:drive_size])
      end
frontend/dcmgr_gui/app/controllers/vdc_management_dialog_controller.rb on lines 415..429
frontend/dcmgr_gui/app/controllers/vdc_management_dialog_controller.rb on lines 430..444

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

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

    when "edit"
      # 編集の場合
      data = Hash.new
      if params[:drive_size] != "" then
        data.store("bandwidth",params[:bandwidth])
frontend/dcmgr_gui/app/controllers/vdc_management_dialog_controller.rb on lines 391..403
frontend/dcmgr_gui/app/controllers/vdc_management_dialog_controller.rb on lines 415..429

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

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 edit_hostnode_exec
    data = {
      "account-id" => params[:account_id],
      "cpu-cores" => params[:cpu_cores],
      "memory-size" => params[:memory_size],
frontend/dcmgr_gui/app/controllers/vdc_management_dialog_controller.rb on lines 217..232

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

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 edit_spec_exec
    data = {
      "account-id" => params[:account_id],
      "cpu-cores" => params[:cpu_cores],
      "memory-size" => params[:memory_size],
frontend/dcmgr_gui/app/controllers/vdc_management_dialog_controller.rb on lines 69..85

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

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

    data = {
      "account-id" => params[:account_id],
      "cpu-cores" => params[:cpu_cores],
      "memory-size" => params[:memory_size],
      "arch" => params[:arch],
frontend/dcmgr_gui/app/controllers/vdc_management_dialog_controller.rb on lines 13..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 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

    data = {
      "account-id" => params[:account_id],
      "cpu-cores" => params[:cpu_cores],
      "memory-size" => params[:memory_size],
      "arch" => params[:arch],
frontend/dcmgr_gui/app/controllers/vdc_management_dialog_controller.rb on lines 164..170

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