axsh/wakame-vdc

View on GitHub

Showing 694 of 1,587 total issues

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

    create_table(:security_group_references) do
      primary_key :id, :type=>"int(11)"
      column :referencer_id, "int(11)", :null=>false
      column :referencee_id, "int(11)", :null=>false

Severity: Minor
Found in dcmgr/config/db/migrations/0002_v1203.rb and 4 other locations - About 20 mins to fix
dcmgr/config/db/migrations/0001_v1110_origin.rb on lines 83..89
dcmgr/config/db/migrations/0001_v1110_origin.rb on lines 343..349
dcmgr/config/db/migrations/0002_v1203.rb on lines 78..84
dcmgr/config/db/migrations/0002_v1203.rb on lines 425..431

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

    create_table(:instance_security_groups) do
      primary_key :id, :type=>"int(11)"
      column :instance_id, "int(11)", :null=>false
      column :security_group_id, "int(11)", :null=>false

Severity: Minor
Found in dcmgr/config/db/migrations/0001_v1110_origin.rb and 4 other locations - About 20 mins to fix
dcmgr/config/db/migrations/0001_v1110_origin.rb on lines 343..349
dcmgr/config/db/migrations/0002_v1203.rb on lines 18..24
dcmgr/config/db/migrations/0002_v1203.rb on lines 78..84
dcmgr/config/db/migrations/0002_v1203.rb on lines 425..431

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

  class NetworkVifMonitorCollection < Dcmgr::Endpoints::ResponseGenerator
    def initialize(ds)
      raise ArgumentError if !ds.is_a?(Sequel::Dataset)
      @ds = ds
    end
dcmgr/lib/dcmgr/endpoints/12.03/responses/account.rb on lines 33..41
dcmgr/lib/dcmgr/endpoints/12.03/responses/alarm.rb on lines 19..27
dcmgr/lib/dcmgr/endpoints/12.03/responses/backup_object.rb on lines 37..45
dcmgr/lib/dcmgr/endpoints/12.03/responses/backup_storage.rb on lines 27..35
dcmgr/lib/dcmgr/endpoints/12.03/responses/dc_network.rb on lines 17..25
dcmgr/lib/dcmgr/endpoints/12.03/responses/host_node.rb on lines 17..25
dcmgr/lib/dcmgr/endpoints/12.03/responses/image.rb on lines 17..25
dcmgr/lib/dcmgr/endpoints/12.03/responses/instance.rb on lines 91..99
dcmgr/lib/dcmgr/endpoints/12.03/responses/ip_pool.rb on lines 24..32
dcmgr/lib/dcmgr/endpoints/12.03/responses/ip_pool.rb on lines 58..66
dcmgr/lib/dcmgr/endpoints/12.03/responses/load_balancer.rb on lines 76..84
dcmgr/lib/dcmgr/endpoints/12.03/responses/network.rb on lines 29..37
dcmgr/lib/dcmgr/endpoints/12.03/responses/network.rb on lines 68..76
dcmgr/lib/dcmgr/endpoints/12.03/responses/network.rb on lines 104..112
dcmgr/lib/dcmgr/endpoints/12.03/responses/network_vif.rb on lines 33..41
dcmgr/lib/dcmgr/endpoints/12.03/responses/queued_job.rb on lines 17..25
dcmgr/lib/dcmgr/endpoints/12.03/responses/report.rb on lines 30..38
dcmgr/lib/dcmgr/endpoints/12.03/responses/resource_label.rb on lines 24..32
dcmgr/lib/dcmgr/endpoints/12.03/responses/security_group.rb on lines 17..25
dcmgr/lib/dcmgr/endpoints/12.03/responses/ssh_key_pair.rb on lines 21..29
dcmgr/lib/dcmgr/endpoints/12.03/responses/storage_node.rb on lines 17..25
dcmgr/lib/dcmgr/endpoints/12.03/responses/tag.rb on lines 20..28
dcmgr/lib/dcmgr/endpoints/12.03/responses/volume.rb on lines 22..30
dcmgr/lib/dcmgr/endpoints/12.03/responses/volume_snapshot.rb on lines 21..29

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

  class QueuedJob < Dcmgr::Endpoints::ResponseGenerator
    def initialize(queued_job)
      raise ArgumentError if !queued_job.is_a?(Dcmgr::Models::QueuedJob)
      @queued_job = queued_job
    end
Severity: Minor
Found in dcmgr/lib/dcmgr/endpoints/12.03/responses/queued_job.rb and 4 other locations - About 20 mins to fix
dcmgr/lib/dcmgr/endpoints/12.03/responses/alarm.rb on lines 6..14
dcmgr/lib/dcmgr/endpoints/12.03/responses/dc_network.rb on lines 4..12
dcmgr/lib/dcmgr/endpoints/12.03/responses/host_node.rb on lines 4..12
dcmgr/lib/dcmgr/endpoints/12.03/responses/storage_node.rb on lines 4..12

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

  def list
   data = {
     :start => params[:start].to_i - 1,
     :limit => params[:limit]
   }
Severity: Minor
Found in frontend/dcmgr_gui/app/controllers/users_controller.rb and 1 other location - About 20 mins to fix
frontend/dcmgr_gui/app/controllers/groups_controller.rb on lines 11..17

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

      def register(load_balancer_id, vifs)
        @collection ||= self.collection_name
        self.collection_name = File.join(@collection, load_balancer_id)
        result = self.put(:register, {:load_balancer_id => load_balancer_id, :vifs => vifs})
        self.collection_name = @collection
client/ruby-hijiki/lib/hijiki/dcmgr_resource/12.03/load_balancer.rb on lines 51..56

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

    delete '/ssh_key_pairs' do
      #M::SshKeyPair.alives.filter(:account_id=>@account.canonical_uuid).all.map { |i|
      uuids = M::SshKeyPair.filter(:account_id=>@account.canonical_uuid).all.map { |i|
        request_forward.delete("/ssh_key_pairs/#{i.canonical_uuid}")
        i.canonical_uuid
Severity: Minor
Found in dcmgr/lib/dcmgr/endpoints/12.03/accounts.rb and 1 other location - About 20 mins to fix
dcmgr/lib/dcmgr/endpoints/12.03/accounts.rb on lines 111..117

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

    if params[:ssh_key_id]
      ssh_key_pair = M::SshKeyPair[params[:ssh_key_id]]

      if ssh_key_pair.nil?
        raise E::UnknownSshKeyPair, "#{params[:ssh_key_id]}"
Severity: Minor
Found in dcmgr/lib/dcmgr/endpoints/12.03/instances.rb and 1 other location - About 20 mins to fix
dcmgr/lib/dcmgr/endpoints/12.03/instances.rb on lines 313..319

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

        ds = User.by_uuid(uuid)
        if options[:with_deleted]
          ds = ds.with_deleted
        end
        user = ds.first || UnknownUUIDError.raise(uuid)
Severity: Minor
Found in frontend/dcmgr_gui/lib/cli/user.rb and 1 other location - About 20 mins to fix
frontend/dcmgr_gui/lib/cli/account.rb on lines 27..57

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

    if params[:backup_storage_id]
      bs = find_by_uuid(M::BackupStorage, params[:backup_storage_id])
      raise UnknownBackupStorage, params[:backup_storage_id] if bs.nil?

      ds = ds.filter(:backup_storage_id=>bs.id)
Severity: Minor
Found in dcmgr/lib/dcmgr/endpoints/12.03/backup_objects.rb and 1 other location - About 20 mins to fix
dcmgr/lib/dcmgr/endpoints/12.03/volume_snapshots.rb on lines 36..40

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

        ds = Account.by_uuid(uuid)
        if options[:with_deleted]
          ds = ds.with_deleted
        end
        acc = ds.first || UnknownUUIDError.raise(uuid)
Severity: Minor
Found in frontend/dcmgr_gui/lib/cli/account.rb and 1 other location - About 20 mins to fix
frontend/dcmgr_gui/lib/cli/user.rb on lines 67..97

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

    if params[:storage_node_id]
      sn = find_by_uuid(M::StorageNode, params[:storage_node_id])
      raise UnknownStorageNode, params[:storage_node_id] if sn.nil?

      ds = ds.filter(:storage_node_id=>sn.id)
Severity: Minor
Found in dcmgr/lib/dcmgr/endpoints/12.03/volume_snapshots.rb and 1 other location - About 20 mins to fix
dcmgr/lib/dcmgr/endpoints/12.03/backup_objects.rb on lines 41..45

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

      if params[:ssh_key_id]
        ssh_key_pair = M::SshKeyPair[params[:ssh_key_id]]

        if ssh_key_pair.nil?
          raise E::UnknownSshKeyPair, "#{params[:ssh_key_id]}"
Severity: Minor
Found in dcmgr/lib/dcmgr/endpoints/12.03/instances.rb and 1 other location - About 20 mins to fix
dcmgr/lib/dcmgr/endpoints/12.03/instances.rb on lines 567..573

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

    delete '/security_groups' do
      #M::SecurityGroup.alives.filter(:account_id=>@account.canonical_uuid).all.map { |i|
      uuids = M::SecurityGroup.filter(:account_id=>@account.canonical_uuid).all.map { |i|
        request_forward.delete("/security_groups/#{i.canonical_uuid}")
        i.canonical_uuid
Severity: Minor
Found in dcmgr/lib/dcmgr/endpoints/12.03/accounts.rb and 1 other location - About 20 mins to fix
dcmgr/lib/dcmgr/endpoints/12.03/accounts.rb on lines 121..127

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

      def unregister(load_balancer_id, vifs)
        @collection ||= self.collection_name
        self.collection_name = File.join(@collection, load_balancer_id)
        result = self.put(:unregister, {:load_balancer_id => load_balancer_id, :vifs => vifs})
        self.collection_name = @collection
client/ruby-hijiki/lib/hijiki/dcmgr_resource/12.03/load_balancer.rb on lines 43..48

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

  def list
   data = {
     :start => params[:start].to_i - 1,
     :limit => params[:limit]
   }
Severity: Minor
Found in frontend/dcmgr_gui/app/controllers/groups_controller.rb and 1 other location - About 20 mins to fix
frontend/dcmgr_gui/app/controllers/users_controller.rb on lines 11..17

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

  class DcNetworkCollection < Dcmgr::Endpoints::ResponseGenerator
    def initialize(ds)
      raise ArgumentError if !ds.is_a?(Sequel::Dataset)
      @ds = ds
    end
Severity: Major
Found in dcmgr/lib/dcmgr/endpoints/12.03/responses/dc_network.rb and 24 other locations - About 20 mins to fix
dcmgr/lib/dcmgr/endpoints/12.03/responses/account.rb on lines 33..41
dcmgr/lib/dcmgr/endpoints/12.03/responses/alarm.rb on lines 19..27
dcmgr/lib/dcmgr/endpoints/12.03/responses/backup_object.rb on lines 37..45
dcmgr/lib/dcmgr/endpoints/12.03/responses/backup_storage.rb on lines 27..35
dcmgr/lib/dcmgr/endpoints/12.03/responses/host_node.rb on lines 17..25
dcmgr/lib/dcmgr/endpoints/12.03/responses/image.rb on lines 17..25
dcmgr/lib/dcmgr/endpoints/12.03/responses/instance.rb on lines 91..99
dcmgr/lib/dcmgr/endpoints/12.03/responses/ip_pool.rb on lines 24..32
dcmgr/lib/dcmgr/endpoints/12.03/responses/ip_pool.rb on lines 58..66
dcmgr/lib/dcmgr/endpoints/12.03/responses/load_balancer.rb on lines 76..84
dcmgr/lib/dcmgr/endpoints/12.03/responses/network.rb on lines 29..37
dcmgr/lib/dcmgr/endpoints/12.03/responses/network.rb on lines 68..76
dcmgr/lib/dcmgr/endpoints/12.03/responses/network.rb on lines 104..112
dcmgr/lib/dcmgr/endpoints/12.03/responses/network_vif.rb on lines 33..41
dcmgr/lib/dcmgr/endpoints/12.03/responses/network_vif_monitor.rb on lines 19..27
dcmgr/lib/dcmgr/endpoints/12.03/responses/queued_job.rb on lines 17..25
dcmgr/lib/dcmgr/endpoints/12.03/responses/report.rb on lines 30..38
dcmgr/lib/dcmgr/endpoints/12.03/responses/resource_label.rb on lines 24..32
dcmgr/lib/dcmgr/endpoints/12.03/responses/security_group.rb on lines 17..25
dcmgr/lib/dcmgr/endpoints/12.03/responses/ssh_key_pair.rb on lines 21..29
dcmgr/lib/dcmgr/endpoints/12.03/responses/storage_node.rb on lines 17..25
dcmgr/lib/dcmgr/endpoints/12.03/responses/tag.rb on lines 20..28
dcmgr/lib/dcmgr/endpoints/12.03/responses/volume.rb on lines 22..30
dcmgr/lib/dcmgr/endpoints/12.03/responses/volume_snapshot.rb on lines 21..29

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

  def detach
    catch_error do
      volume_ids = params[:ids]
      res = []
      volume_ids.each do |volume_id|
Severity: Major
Found in frontend/dcmgr_gui/app/controllers/volumes_controller.rb and 8 other locations - About 15 mins to fix
frontend/dcmgr_gui/app/controllers/backups_controller.rb on lines 8..16
frontend/dcmgr_gui/app/controllers/instances_controller.rb on lines 85..93
frontend/dcmgr_gui/app/controllers/instances_controller.rb on lines 96..104
frontend/dcmgr_gui/app/controllers/instances_controller.rb on lines 107..115
frontend/dcmgr_gui/app/controllers/instances_controller.rb on lines 118..126
frontend/dcmgr_gui/app/controllers/instances_controller.rb on lines 141..149
frontend/dcmgr_gui/app/controllers/instances_controller.rb on lines 152..160
frontend/dcmgr_gui/app/controllers/volumes_controller.rb on lines 43..51

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

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

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

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

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

Refactorings

Further Reading

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

    if params[:service_type]
      Dcmgr::Configurations.dcmgr.service_types[params[:service_type]] || raise(E::InvalidParameter, :service_type)
      ds = ds.filter(:service_type=>params[:service_type])
Severity: Minor
Found in dcmgr/lib/dcmgr/endpoints/12.03/backup_objects.rb and 1 other location - About 15 mins to fix
dcmgr/lib/dcmgr/endpoints/12.03/instances.rb on lines 166..168

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

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

  def poweron
    catch_error do
      instance_ids = params[:ids]
      res = []
      instance_ids.each do |instance_id|
Severity: Major
Found in frontend/dcmgr_gui/app/controllers/instances_controller.rb and 8 other locations - About 15 mins to fix
frontend/dcmgr_gui/app/controllers/backups_controller.rb on lines 8..16
frontend/dcmgr_gui/app/controllers/instances_controller.rb on lines 85..93
frontend/dcmgr_gui/app/controllers/instances_controller.rb on lines 96..104
frontend/dcmgr_gui/app/controllers/instances_controller.rb on lines 107..115
frontend/dcmgr_gui/app/controllers/instances_controller.rb on lines 118..126
frontend/dcmgr_gui/app/controllers/instances_controller.rb on lines 141..149
frontend/dcmgr_gui/app/controllers/volumes_controller.rb on lines 43..51
frontend/dcmgr_gui/app/controllers/volumes_controller.rb on lines 100..108

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

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