cloudfoundry/cloud_controller_ng

View on GitHub

Showing 248 of 2,661 total issues

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

    def read_body
      payload = body.read
      Oj.load(payload, symbol_keys: true)
    rescue StandardError => e
      logger.error('diego.task.parse-error', payload: payload, error: e.to_s)
Severity: Minor
Found in app/controllers/internal/task_completion_controller.rb and 1 other location - About 35 mins to fix
app/controllers/internal/staging_completion_controller.rb on lines 123..129

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

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

      hash[:included][:service_brokers] = service_brokers.sort_by(&:created_at).map do |broker|
        broker_view = {}
        broker_view[:name] = broker.name if @fields.include?('name')
        broker_view[:guid] = broker.guid if @fields.include?('guid')
        broker_view
Severity: Minor
Found in app/decorators/field_service_plan_service_broker_decorator.rb and 2 other locations - About 35 mins to fix
app/decorators/field_service_instance_organization_decorator.rb on lines 20..24
app/decorators/field_service_offering_service_broker_decorator.rb on lines 18..22

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

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

  change do
    create_table(:service_broker_states) do
      VCAP::Migration.common(self)

      String :state, size: 50, null: false
Severity: Minor
Found in db/migrations/20190905131313_create_service_broker_states.rb and 1 other location - About 35 mins to fix
db/migrations/20190923131251_create_job_warnings_table.rb on lines 2..11

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

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

  change do
    create_table(:job_warnings) do
      VCAP::Migration.common(self)

      String :detail, size: 16_000, null: false
Severity: Minor
Found in db/migrations/20190923131251_create_job_warnings_table.rb and 1 other location - About 35 mins to fix
db/migrations/20190905131313_create_service_broker_states.rb on lines 2..11

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

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

      hash[:included][:service_brokers] = service_brokers.sort_by(&:created_at).map do |broker|
        broker_view = {}
        broker_view[:name] = broker.name if @fields.include?('name')
        broker_view[:guid] = broker.guid if @fields.include?('guid')
        broker_view
app/decorators/field_service_instance_organization_decorator.rb on lines 20..24
app/decorators/field_service_plan_service_broker_decorator.rb on lines 19..23

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

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

  lunr.SortedSet.prototype.forEach = function (fn, ctx) {
    return this.elements.forEach(fn, ctx)
  }
Severity: Minor
Found in docs/v3/source/javascripts/lib/_lunr.js and 2 other locations - About 35 mins to fix
docs/v3/source/javascripts/lib/_lunr.js on lines 614..616
docs/v3/source/javascripts/lib/_lunr.js on lines 830..832

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

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

  lunr.SortedSet.prototype.map = function (fn, ctx) {
    return this.elements.map(fn, ctx)
  }
Severity: Minor
Found in docs/v3/source/javascripts/lib/_lunr.js and 2 other locations - About 35 mins to fix
docs/v3/source/javascripts/lib/_lunr.js on lines 629..631
docs/v3/source/javascripts/lib/_lunr.js on lines 830..832

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

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

  lunr.Index.prototype.off = function (name, fn) {
    return this.eventEmitter.removeListener(name, fn)
  }
Severity: Minor
Found in docs/v3/source/javascripts/lib/_lunr.js and 2 other locations - About 35 mins to fix
docs/v3/source/javascripts/lib/_lunr.js on lines 614..616
docs/v3/source/javascripts/lib/_lunr.js on lines 629..631

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

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

        Event.create(
          type: EventTypes::APP_DEPLOYMENT_CREATE,
          actor: user_audit_info.user_guid,
          actor_type: 'user',
          actor_name: user_audit_info.user_email,
Severity: Minor
Found in app/repositories/deployment_event_repository.rb and 2 other locations - About 30 mins to fix
app/repositories/build_event_repository.rb on lines 14..27
app/repositories/deployment_event_repository.rb on lines 41..54

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

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 emit(app_id, message)
        fluent_emitter.emit(app_id, message) if fluent_emitter
        emitter.emit(app_id, message, generate_tags(app_id)) if emitter
      rescue StandardError => e
        logger.error('app_event_emitter.emit.failed', app_id: app_id, message: message, error: e)
Severity: Minor
Found in lib/app_log_emitter.rb and 1 other location - About 30 mins to fix
lib/app_log_emitter.rb on lines 15..20

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

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 emit_error(app_id, message)
        fluent_emitter.emit(app_id, message) if fluent_emitter
        emitter.emit_error(app_id, message, generate_tags(app_id)) if emitter
      rescue StandardError => e
        logger.error('app_event_emitter.emit_error.failed', app_id: app_id, message: message, error: e)
Severity: Minor
Found in lib/app_log_emitter.rb and 1 other location - About 30 mins to fix
lib/app_log_emitter.rb on lines 8..13

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

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

        Event.create(
          type: EventTypes::APP_DEPLOYMENT_CANCEL,
          actor: user_audit_info.user_guid,
          actor_type: 'user',
          actor_name: user_audit_info.user_email,
Severity: Minor
Found in app/repositories/deployment_event_repository.rb and 2 other locations - About 30 mins to fix
app/repositories/build_event_repository.rb on lines 14..27
app/repositories/deployment_event_repository.rb on lines 17..30

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

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

        Event.create(
          type: EventTypes::APP_BUILD_CREATE,
          actor: user_audit_info.user_guid,
          actor_type: 'user',
          actor_name: user_audit_info.user_email,
Severity: Minor
Found in app/repositories/build_event_repository.rb and 2 other locations - About 30 mins to fix
app/repositories/deployment_event_repository.rb on lines 17..30
app/repositories/deployment_event_repository.rb on lines 41..54

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

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 space_validation_error!(type, error, user, space)
      error!("User '#{user.presentation_name}' already has '#{type}' role in space '#{space.name}'.") if error.errors.on(%i[space_id user_id])&.any? { |e| [:unique].include?(e) }

      error!(error.message)
Severity: Minor
Found in app/actions/role_create.rb and 1 other location - About 30 mins to fix
app/actions/role_create.rb on lines 106..111

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

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

    create_table :runtimes do
      VCAP::Migration.common(self)

      String :name,        null: false, case_insensitive: true
      String :description, null: false
Severity: Minor
Found in db/migrations/20130131184954_new_initial_schema.rb and 1 other location - About 30 mins to fix
db/migrations/20130131184954_new_initial_schema.rb on lines 106..114

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

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

    create_table :frameworks do
      VCAP::Migration.common(self)

      String :name,        null: false, case_insenstive: true
      String :description, null: false
Severity: Minor
Found in db/migrations/20130131184954_new_initial_schema.rb and 1 other location - About 30 mins to fix
db/migrations/20130131184954_new_initial_schema.rb on lines 116..124

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

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 organization_validation_error!(type, error, user, organization)
      error!("User '#{user.presentation_name}' already has '#{type}' role in organization '#{organization.name}'.") if error.errors.on(%i[organization_id user_id])&.any? do |e|
                                                                                                                         [:unique].include?(e)
                                                                                                                       end

Severity: Minor
Found in app/actions/role_create.rb and 1 other location - About 30 mins to fix
app/actions/role_create.rb on lines 100..103

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

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

  change do
    create_table(:route_labels) do
      VCAP::Migration.common(self)
      VCAP::Migration.labels_common(self, :route_labels, :routes)
    end
Severity: Major
Found in db/migrations/20190531214252_create_route_metadata_tables.rb and 13 other locations - About 25 mins to fix
db/migrations/20190110224601_create_isolation_segment_metadata_tables.rb on lines 2..10
db/migrations/20190116193201_create_process_metadata_tables.rb on lines 2..10
db/migrations/20190116225537_create_deployment_metadata_tables.rb on lines 2..10
db/migrations/20190128233032_create_buildpack_metadata_tables.rb on lines 2..10
db/migrations/20190502172509_create_domain_metadata_tables.rb on lines 2..10
db/migrations/20190913184731_create_user_metadata_tables.rb on lines 2..10
db/migrations/20191203153701_create_service_broker_metadata_tables.rb on lines 2..10
db/migrations/20191204144101_create_service_broker_update_request_metadata_tables.rb on lines 2..10
db/migrations/20200121104723_create_service_offering_metadata.rb on lines 2..10
db/migrations/20200210103523_create_service_plan_metadata.rb on lines 2..10
db/migrations/20201030105232_create_service_route_bindings_metadata_table.rb on lines 2..10
db/migrations/20210105151532_create_service_bindings_metadata_tables.rb on lines 2..10
db/migrations/20210106120645_create_service_keys_metadata_tables.rb on lines 2..10

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

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

  change do
    create_table(:isolation_segment_annotations) do
      VCAP::Migration.common(self)
      VCAP::Migration.annotations_common(self, :isolation_segment_annotations, :isolation_segments)
    end
db/migrations/20190116193201_create_process_metadata_tables.rb on lines 2..10
db/migrations/20190116225537_create_deployment_metadata_tables.rb on lines 2..10
db/migrations/20190128233032_create_buildpack_metadata_tables.rb on lines 2..10
db/migrations/20190502172509_create_domain_metadata_tables.rb on lines 2..10
db/migrations/20190531214252_create_route_metadata_tables.rb on lines 2..10
db/migrations/20190913184731_create_user_metadata_tables.rb on lines 2..10
db/migrations/20191203153701_create_service_broker_metadata_tables.rb on lines 2..10
db/migrations/20191204144101_create_service_broker_update_request_metadata_tables.rb on lines 2..10
db/migrations/20200121104723_create_service_offering_metadata.rb on lines 2..10
db/migrations/20200210103523_create_service_plan_metadata.rb on lines 2..10
db/migrations/20201030105232_create_service_route_bindings_metadata_table.rb on lines 2..10
db/migrations/20210105151532_create_service_bindings_metadata_tables.rb on lines 2..10
db/migrations/20210106120645_create_service_keys_metadata_tables.rb on lines 2..10

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

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

  change do
    create_table(:process_annotations) do
      VCAP::Migration.common(self)
      VCAP::Migration.annotations_common(self, :process_annotations, :processes)
    end
db/migrations/20190110224601_create_isolation_segment_metadata_tables.rb on lines 2..10
db/migrations/20190116225537_create_deployment_metadata_tables.rb on lines 2..10
db/migrations/20190128233032_create_buildpack_metadata_tables.rb on lines 2..10
db/migrations/20190502172509_create_domain_metadata_tables.rb on lines 2..10
db/migrations/20190531214252_create_route_metadata_tables.rb on lines 2..10
db/migrations/20190913184731_create_user_metadata_tables.rb on lines 2..10
db/migrations/20191203153701_create_service_broker_metadata_tables.rb on lines 2..10
db/migrations/20191204144101_create_service_broker_update_request_metadata_tables.rb on lines 2..10
db/migrations/20200121104723_create_service_offering_metadata.rb on lines 2..10
db/migrations/20200210103523_create_service_plan_metadata.rb on lines 2..10
db/migrations/20201030105232_create_service_route_bindings_metadata_table.rb on lines 2..10
db/migrations/20210105151532_create_service_bindings_metadata_tables.rb on lines 2..10
db/migrations/20210106120645_create_service_keys_metadata_tables.rb on lines 2..10

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

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