axsh/wakame-vdc

View on GitHub

Showing 1,587 of 1,587 total issues

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

  class BackupObjectCollection < 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/backup_object.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_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/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 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 25 locations. Consider refactoring.
Open

  class IpPoolCollection < 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/ip_pool.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/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 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 5 locations. Consider refactoring.
Open

  class Alarm < Dcmgr::Endpoints::ResponseGenerator
    def initialize(object)
      raise ArgumentError if !object.is_a?(Dcmgr::Models::Alarm)
      @object = object
    end
Severity: Minor
Found in dcmgr/lib/dcmgr/endpoints/12.03/responses/alarm.rb and 4 other locations - About 20 mins to fix
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/queued_job.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 25 locations. Consider refactoring.
Open

  class ReportCollection < 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/report.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/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/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/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

        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

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

  class BackupStorageCollection < 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/backup_storage.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/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/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

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

  class InvalidStateError < Error
    def initialize(state, exit_code = 100)
      possible_states = C::Image::STATES
      super("Not a valid state: '#{state}'. Must be one of (#{possible_states.join(", ")})")
    end
Severity: Minor
Found in dcmgr/lib/dcmgr/cli/errors.rb and 1 other location - About 15 mins to fix
dcmgr/lib/dcmgr/cli/errors.rb on lines 62..70

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

  class Error < StandardError
    attr_reader :exit_code
    def initialize(msg, exit_code=1)
      super(msg)
      @exit_code = exit_code
Severity: Minor
Found in frontend/dcmgr_gui/lib/cli/errors.rb and 1 other location - About 15 mins to fix
dcmgr/lib/dcmgr/cli/errors.rb on lines 5..16

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

  delete '/:id' do
    # description "Remove network information"
    # params :id required
    nw = find_by_uuid(M::Network, params[:id])
    raise E::UnknownNetwork, params[:id] if nw.nil?
Severity: Minor
Found in dcmgr/lib/dcmgr/endpoints/12.03/networks.rb and 1 other location - About 15 mins to fix
dcmgr/lib/dcmgr/endpoints/12.03/ip_pools.rb on lines 54..61

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 start
    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 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
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

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/instances.rb and 1 other location - About 15 mins to fix
dcmgr/lib/dcmgr/endpoints/12.03/backup_objects.rb on lines 48..50

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 terminate
    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 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
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

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

  class InvalidOSTypeError < Error
    def initialize(os_type, exit_code = 100)
      possible_os_types = C::Image::OS_TYPES
      super("Not a valid os_type: '#{os_type}'. Must be one of (#{possible_os_types.join(", ")})")
    end
Severity: Minor
Found in dcmgr/lib/dcmgr/cli/errors.rb and 1 other location - About 15 mins to fix
dcmgr/lib/dcmgr/cli/errors.rb on lines 51..59

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

    if params[:storage_node_id]
      hn = M::StorageNode[params[:storage_node_id]] rescue raise(E::InvalidParameter, :storage_node_id)
      ds = ds.filter(:storage_node_id=>hn.id)
Severity: Minor
Found in dcmgr/lib/dcmgr/endpoints/12.03/volumes.rb and 1 other location - About 15 mins to fix
dcmgr/lib/dcmgr/endpoints/12.03/instances.rb on lines 161..163

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 stop
    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 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
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