Showing 49 of 49 total issues
Complex method describe(creation)::context#with known isbn (223.0) Open
context 'with known isbn' do
subject(:product) { variant.product }
it { expect(product).not_to be_nil }
it { expect(product).to be_persisted }
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Class DefaultVariantProvider
has 35 methods (exceeds 20 allowed). Consider refactoring. Open
class DefaultVariantProvider < Spree::BaseAction # rubocop:disable Metrics/ClassLength
KEYWORDS_DELIMITER = ' '.freeze
VALIDATION_SCHEMA =
::Dry::Validation.Schema do
required(:sku).filled(:str?)
Complex method describe(creation)::context#when variant already exists (69.3) Open
context 'when variant already exists' do
let(:isbn) { '9780979728303' }
before do
described_class.call(item_json)
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Assignment Branch Condition size for build_option_value is too high. [26.78/15] Open
def build_option_value(opt_name, opt_value)
# no option values on master
return if is_master
option_type = Spree::OptionType.where(name: opt_name).first_or_initialize do |o|
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Complex method context(when user is authorized)::context#when has content (49.9) Open
context 'when has content' do
let(:content) { File.read(File.join(Dir.pwd, 'spec/fixtures', 'inventory.csv')) }
it { is_expected.to have_http_status(:ok) }
it { expect(json).to include(status: 'completed') }
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Complex method context(when upload csv)::describe#perform worker (48.2) Open
describe 'perform worker' do
before { perform }
it { expect(Spree::Product.count).to eq(5) }
it { expect(Spree::Variant.count).to eq(10) }
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Method has too many lines. [17/10] Open
def build_option_value(opt_name, opt_value)
# no option values on master
return if is_master
option_type = Spree::OptionType.where(name: opt_name).first_or_initialize do |o|
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Complex method context#when pass 1 item (40.3) Open
context 'when pass 1 item' do
let(:items) { [item] }
it { expect(upload.total).to eq(1) }
it { expect(upload.reload.processed).to eq(1) }
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Complex method context#when json have wrong items (40.2) Open
context 'when json have wrong items' do
let(:payload) { '{ "items": [{"id": "some"}] }' }
before do
call
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Assignment Branch Condition size for update_variant is too high. [17.52/15] Open
def update_variant(variant, item)
variant.price = variant.cost_price = item[:price]
variant.notes = item[:notes] if variant.respond_to?(:notes)
update_variant_hook(variant, item)
variant.build_options(variant_options(item))
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Complex method context#when have error (38.6) Open
context 'when have error' do
let(:items) { [{ ean: 'UNKNOWN' }] }
it { expect(upload.total).to eq(1) }
it { expect(upload.reload.processed).to eq(1) }
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Method has too many lines. [11/10] Open
def perform(upload_item_id)
item = UploadItem.find(upload_item_id)
upload = item.upload
options = item.options
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Assignment Branch Condition size for perform is too high. [16.52/15] Open
def perform(upload_item_id)
item = UploadItem.find(upload_item_id)
upload = item.upload
options = item.options
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Complex method describe(validation)::it#raises exception (36.7) Open
it 'raises exception' do
expect { variant }.to raise_error(Spree::ImportError).with_message(include(':sku=>["is missing"]'))
expect { variant }.to raise_error(Spree::ImportError).with_message(include(':quantity=>["must be filled"]'))
expect { variant }.to raise_error(Spree::ImportError).with_message(include(':price=>["must be filled"]'))
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Assignment Branch Condition size for call is too high. [15.94/15] Open
def call # rubocop:disable Metrics/MethodLength
total = 0
args = []
map_items do |item_json, index|
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Complex method context#when file is correct (34.9) Open
context 'when file is correct' do
let(:local_file) { File.join(Dir.pwd, 'spec/fixtures', 'inventory.csv') }
before { call }
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Complex method context(when provider is specified)::context#with existing provider (34.1) Open
context 'with existing provider' do
class RealSellerVariantProvider < Spree::Inventory::Providers::Fake::VariantProvider; end
let(:opts) { { file_path: '', product_type: :fake, provider: :real_seller } }
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Complex method Spree::VariantDecorator#build_option_value (33.1) Open
def build_option_value(opt_name, opt_value)
# no option values on master
return if is_master
option_type = Spree::OptionType.where(name: opt_name).first_or_initialize do |o|
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Complex method Spree::UploadInventoryWorker#upload_action (29.4) Open
def upload_action(local_file, format) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
case format
when 'json'
payload = File.read(local_file)
Inventory::JsonImportAction.call(payload, upload: upload, options: options)
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Method call
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def call
return if isbn == UNKNOWN_ISBN
{
title: book_title,