Showing 59 of 227 total issues

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

  module Orders
    class Approve
      prepend Spree::ServiceModule::Base

      def call(order:, approver: nil)
Severity: Minor
Found in core/app/services/spree/orders/approve.rb and 1 other location - About 35 mins to fix
core/app/services/spree/orders/cancel.rb on lines 2..14

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

    create_table "spree_role_users", force: :cascade do |t|
      t.bigint "role_id"
      t.bigint "user_id"
      t.datetime "created_at"
      t.datetime "updated_at"
Severity: Minor
Found in core/db/migrate/20210914000000_spree_four_three.rb and 2 other locations - About 35 mins to fix
core/db/migrate/20210914000000_spree_four_three.rb on lines 580..587
core/db/migrate/20210914000000_spree_four_three.rb on lines 847..854

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

  class StoreProduct < Spree::Base
    self.table_name = 'spree_products_stores'

    belongs_to :store, class_name: 'Spree::Store', touch: true
    belongs_to :product, class_name: 'Spree::Product', touch: true
Severity: Minor
Found in core/app/models/spree/store_product.rb and 2 other locations - About 30 mins to fix
core/app/models/spree/store_payment_method.rb on lines 2..10
core/app/models/spree/store_promotion.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 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

  class StorePaymentMethod < Spree::Base
    self.table_name = 'spree_payment_methods_stores'

    belongs_to :store, class_name: 'Spree::Store', touch: true
    belongs_to :payment_method, class_name: 'Spree::PaymentMethod', touch: true
Severity: Minor
Found in core/app/models/spree/store_payment_method.rb and 2 other locations - About 30 mins to fix
core/app/models/spree/store_product.rb on lines 2..10
core/app/models/spree/store_promotion.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 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

  class StorePromotion < Spree::Base
    self.table_name = 'spree_promotions_stores'

    belongs_to :store, class_name: 'Spree::Store', touch: true
    belongs_to :promotion, class_name: 'Spree::Promotion', touch: true
Severity: Minor
Found in core/app/models/spree/store_promotion.rb and 2 other locations - About 30 mins to fix
core/app/models/spree/store_payment_method.rb on lines 2..10
core/app/models/spree/store_product.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 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 4 locations. Consider refactoring.
Open

shared_examples_for 'read only' do
  it 'should not allow create' do
    expect(ability).to_not be_able_to(:create, resource)
  end

Severity: Minor
Found in core/lib/spree/testing_support/ability_helpers.rb and 3 other locations - About 25 mins to fix
core/lib/spree/testing_support/ability_helpers.rb on lines 18..28
core/lib/spree/testing_support/ability_helpers.rb on lines 57..67
core/lib/spree/testing_support/ability_helpers.rb on lines 85..95

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

shared_examples_for 'update only' do
  it 'should not allow create' do
    expect(ability).to_not be_able_to(:create, resource)
  end

Severity: Minor
Found in core/lib/spree/testing_support/ability_helpers.rb and 3 other locations - About 25 mins to fix
core/lib/spree/testing_support/ability_helpers.rb on lines 18..28
core/lib/spree/testing_support/ability_helpers.rb on lines 57..67
core/lib/spree/testing_support/ability_helpers.rb on lines 71..81

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

shared_examples_for 'create only' do
  it 'should allow create' do
    expect(ability).to be_able_to(:create, resource)
  end

Severity: Minor
Found in core/lib/spree/testing_support/ability_helpers.rb and 3 other locations - About 25 mins to fix
core/lib/spree/testing_support/ability_helpers.rb on lines 18..28
core/lib/spree/testing_support/ability_helpers.rb on lines 71..81
core/lib/spree/testing_support/ability_helpers.rb on lines 85..95

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

shared_examples_for 'access denied' do
  it 'should not allow read' do
    expect(ability).to_not be_able_to(:read, resource)
  end

Severity: Minor
Found in core/lib/spree/testing_support/ability_helpers.rb and 3 other locations - About 25 mins to fix
core/lib/spree/testing_support/ability_helpers.rb on lines 57..67
core/lib/spree/testing_support/ability_helpers.rb on lines 71..81
core/lib/spree/testing_support/ability_helpers.rb on lines 85..95

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

    if not Spree::Taxon::Translation.exists?
      ActiveRecord::Base.connection.execute("
      INSERT INTO #{TAXON_TRANSLATIONS_TABLE} (name, description, meta_title, meta_description, meta_keywords, permalink, locale, spree_taxon_id, created_at, updated_at)
      SELECT name, description, meta_title, meta_description, meta_keywords, permalink, '#{DEFAULT_LOCALE}' as locale, id, created_at, updated_at FROM #{TAXONS_TABLE};
                                            ")
core/db/migrate/20230111122511_transfer_product_and_taxon_data_to_translatable_tables.rb on lines 13..19

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 29.

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 not Spree::Product::Translation.exists?
      ActiveRecord::Base.connection.execute("
      INSERT INTO #{PRODUCT_TRANSLATIONS_TABLE} (name, description, locale, spree_product_id, created_at, updated_at, meta_description, meta_keywords, meta_title, slug)
      SELECT name, description, '#{DEFAULT_LOCALE}' as locale, id, created_at, updated_at, meta_description, meta_keywords, meta_title, slug FROM #{PRODUCTS_TABLE};
                                            ")
core/db/migrate/20230111122511_transfer_product_and_taxon_data_to_translatable_tables.rb on lines 25..31

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 29.

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 change
    change_table :spree_products do |t|
      if t.respond_to? :jsonb
        add_column :spree_products, :public_metadata, :jsonb
        add_column :spree_products, :private_metadata, :jsonb
core/db/migrate/20210915064321_add_metadata_to_spree_orders.rb on lines 2..10
core/db/migrate/20210915064323_add_metadata_to_spree_variants.rb on lines 2..10
core/db/migrate/20210915064324_add_metadata_to_spree_line_items.rb on lines 2..10
core/db/migrate/20210915064325_add_metadata_to_spree_shipments.rb on lines 2..10
core/db/migrate/20210915064326_add_metadata_to_spree_payments.rb on lines 2..10
core/db/migrate/20210915064328_add_metadata_to_spree_stock_transfers.rb on lines 2..10
core/db/migrate/20220120092821_add_metadata_to_spree_tax_rates.rb on lines 2..10
core/db/migrate/20220613133029_add_metadata_to_spree_stock_items.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 28.

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

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

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

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

Refactorings

Further Reading

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

      def ship_address_id=(id)
        address = Spree::Address.find_by(id: id)
        if address && address.user_id == user_id
          self['ship_address_id'] = address.id
          ship_address.reload
Severity: Minor
Found in core/app/models/spree/order/address_book.rb and 1 other location - About 20 mins to fix
core/app/models/spree/order/address_book.rb on lines 21..28

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 28.

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

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

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

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

Refactorings

Further Reading

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

  def change
    change_table :spree_orders do |t|
      if t.respond_to? :jsonb
        add_column :spree_orders, :public_metadata, :jsonb
        add_column :spree_orders, :private_metadata, :jsonb
Severity: Major
Found in core/db/migrate/20210915064321_add_metadata_to_spree_orders.rb and 8 other locations - About 20 mins to fix
core/db/migrate/20210915064322_add_metadata_to_spree_products.rb on lines 2..10
core/db/migrate/20210915064323_add_metadata_to_spree_variants.rb on lines 2..10
core/db/migrate/20210915064324_add_metadata_to_spree_line_items.rb on lines 2..10
core/db/migrate/20210915064325_add_metadata_to_spree_shipments.rb on lines 2..10
core/db/migrate/20210915064326_add_metadata_to_spree_payments.rb on lines 2..10
core/db/migrate/20210915064328_add_metadata_to_spree_stock_transfers.rb on lines 2..10
core/db/migrate/20220120092821_add_metadata_to_spree_tax_rates.rb on lines 2..10
core/db/migrate/20220613133029_add_metadata_to_spree_stock_items.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 28.

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

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

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

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

Refactorings

Further Reading

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

  def change
    change_table :spree_stock_items do |t|
      if t.respond_to? :jsonb
        add_column :spree_stock_items, :public_metadata, :jsonb
        add_column :spree_stock_items, :private_metadata, :jsonb
core/db/migrate/20210915064321_add_metadata_to_spree_orders.rb on lines 2..10
core/db/migrate/20210915064322_add_metadata_to_spree_products.rb on lines 2..10
core/db/migrate/20210915064323_add_metadata_to_spree_variants.rb on lines 2..10
core/db/migrate/20210915064324_add_metadata_to_spree_line_items.rb on lines 2..10
core/db/migrate/20210915064325_add_metadata_to_spree_shipments.rb on lines 2..10
core/db/migrate/20210915064326_add_metadata_to_spree_payments.rb on lines 2..10
core/db/migrate/20210915064328_add_metadata_to_spree_stock_transfers.rb on lines 2..10
core/db/migrate/20220120092821_add_metadata_to_spree_tax_rates.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 28.

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

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

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

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

Refactorings

Further Reading

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

  def change
    change_table :spree_tax_rates do |t|
      if t.respond_to? :jsonb
        add_column :spree_tax_rates, :public_metadata, :jsonb
        add_column :spree_tax_rates, :private_metadata, :jsonb
core/db/migrate/20210915064321_add_metadata_to_spree_orders.rb on lines 2..10
core/db/migrate/20210915064322_add_metadata_to_spree_products.rb on lines 2..10
core/db/migrate/20210915064323_add_metadata_to_spree_variants.rb on lines 2..10
core/db/migrate/20210915064324_add_metadata_to_spree_line_items.rb on lines 2..10
core/db/migrate/20210915064325_add_metadata_to_spree_shipments.rb on lines 2..10
core/db/migrate/20210915064326_add_metadata_to_spree_payments.rb on lines 2..10
core/db/migrate/20210915064328_add_metadata_to_spree_stock_transfers.rb on lines 2..10
core/db/migrate/20220613133029_add_metadata_to_spree_stock_items.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 28.

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

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

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

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

Refactorings

Further Reading

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

      def silence_stream(stream)
        old_stream = stream.dup
        stream.reopen(RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? 'NUL:' : '/dev/null')
        stream.sync = true
        yield
Severity: Minor
Found in core/lib/spree/testing_support/kernel.rb and 1 other location - About 20 mins to fix
core/lib/generators/spree/install/install_generator.rb on lines 241..249

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 28.

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

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

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

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

Refactorings

Further Reading

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

  def change
    change_table :spree_variants do |t|
      if t.respond_to? :jsonb
        add_column :spree_variants, :public_metadata, :jsonb
        add_column :spree_variants, :private_metadata, :jsonb
core/db/migrate/20210915064321_add_metadata_to_spree_orders.rb on lines 2..10
core/db/migrate/20210915064322_add_metadata_to_spree_products.rb on lines 2..10
core/db/migrate/20210915064324_add_metadata_to_spree_line_items.rb on lines 2..10
core/db/migrate/20210915064325_add_metadata_to_spree_shipments.rb on lines 2..10
core/db/migrate/20210915064326_add_metadata_to_spree_payments.rb on lines 2..10
core/db/migrate/20210915064328_add_metadata_to_spree_stock_transfers.rb on lines 2..10
core/db/migrate/20220120092821_add_metadata_to_spree_tax_rates.rb on lines 2..10
core/db/migrate/20220613133029_add_metadata_to_spree_stock_items.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 28.

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

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

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

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

Refactorings

Further Reading

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

  def change
    change_table :spree_stock_transfers do |t|
      if t.respond_to? :jsonb
        add_column :spree_stock_transfers, :public_metadata, :jsonb
        add_column :spree_stock_transfers, :private_metadata, :jsonb
core/db/migrate/20210915064321_add_metadata_to_spree_orders.rb on lines 2..10
core/db/migrate/20210915064322_add_metadata_to_spree_products.rb on lines 2..10
core/db/migrate/20210915064323_add_metadata_to_spree_variants.rb on lines 2..10
core/db/migrate/20210915064324_add_metadata_to_spree_line_items.rb on lines 2..10
core/db/migrate/20210915064325_add_metadata_to_spree_shipments.rb on lines 2..10
core/db/migrate/20210915064326_add_metadata_to_spree_payments.rb on lines 2..10
core/db/migrate/20220120092821_add_metadata_to_spree_tax_rates.rb on lines 2..10
core/db/migrate/20220613133029_add_metadata_to_spree_stock_items.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 28.

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

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

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

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

Refactorings

Further Reading

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

  def change
    change_table :spree_line_items do |t|
      if t.respond_to? :jsonb
        add_column :spree_line_items, :public_metadata, :jsonb
        add_column :spree_line_items, :private_metadata, :jsonb
core/db/migrate/20210915064321_add_metadata_to_spree_orders.rb on lines 2..10
core/db/migrate/20210915064322_add_metadata_to_spree_products.rb on lines 2..10
core/db/migrate/20210915064323_add_metadata_to_spree_variants.rb on lines 2..10
core/db/migrate/20210915064325_add_metadata_to_spree_shipments.rb on lines 2..10
core/db/migrate/20210915064326_add_metadata_to_spree_payments.rb on lines 2..10
core/db/migrate/20210915064328_add_metadata_to_spree_stock_transfers.rb on lines 2..10
core/db/migrate/20220120092821_add_metadata_to_spree_tax_rates.rb on lines 2..10
core/db/migrate/20220613133029_add_metadata_to_spree_stock_items.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 28.

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

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

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

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

Refactorings

Further Reading

Severity
Category
Status
Source
Language