Showing 220 of 4,290 total issues

Function css_browser_selector has a Cognitive Complexity of 363 (exceeds 5 allowed). Consider refactoring.
Open

function css_browser_selector(u)
    {
    var    uaInfo = {},
        screens = [320, 480, 640, 768, 1024, 1152, 1280, 1440, 1680, 1920, 2560],
        allScreens = screens.length,
Severity: Minor
Found in guides/content/assets/javascripts/css_browser_selector_dev.js - About 1 wk to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

File resources.rb has 1038 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'pp'
require 'yajl/json_gem'
require 'stringio'
require 'cgi'

Severity: Major
Found in guides/lib/resources.rb - About 2 days to fix

    File order_spec.rb has 900 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'spec_helper'
    
    class FakeCalculator < Spree::Calculator
      def compute(_computable)
        5
    Severity: Major
    Found in core/spec/models/spree/order_spec.rb - About 2 days to fix

      Method up has 410 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def up
          # This migration is just a compressed version of all the previous
          # migrations for spree_core. Do not run it if one of the core tables
          # already exists. Assume the best.
          return if data_source_exists?(:spree_addresses)
      Severity: Major
      Found in core/db/migrate/20120831092320_spree_one_two.rb - About 2 days to fix

        File payment_spec.rb has 745 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'spec_helper'
        
        describe Spree::Payment, type: :model do
          let(:order) { Spree::Order.create }
          let(:refund_reason) { create(:refund_reason) }
        Severity: Major
        Found in core/spec/models/spree/payment_spec.rb - About 1 day to fix

          Class Order has 84 methods (exceeds 20 allowed). Consider refactoring.
          Open

            class Order < Spree::Base
              PAYMENT_STATES = %w(balance_due credit_owed failed paid void)
              SHIPMENT_STATES = %w(backorder canceled partial pending ready shipped)
          
              include Spree::Order::Checkout
          Severity: Major
          Found in core/app/models/spree/order.rb - About 1 day to fix

            File checkout_spec.rb has 636 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require 'spec_helper'
            require 'spree/testing_support/order_walkthrough'
            
            describe Spree::Order, type: :model do
              let(:order) { Spree::Order.new }
            Severity: Major
            Found in core/spec/models/spree/order/checkout_spec.rb - About 1 day to fix

              File variant_spec.rb has 628 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require 'spec_helper'
              
              describe Spree::Variant, type: :model do
                let!(:variant) { create(:variant) }
                let(:master_variant) { create(:master_variant) }
              Severity: Major
              Found in core/spec/models/spree/variant_spec.rb - About 1 day to fix

                File store_credit_spec.rb has 619 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                require 'spec_helper'
                
                describe 'StoreCredit' do
                  let(:currency) { 'TEST' }
                  let(:store_credit) { build(:store_credit, store_credit_attrs) }
                Severity: Major
                Found in core/spec/models/spree/store_credit_spec.rb - About 1 day to fix

                  File shipment_spec.rb has 616 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  require 'spec_helper'
                  require 'benchmark'
                  
                  describe Spree::Shipment, type: :model do
                    let(:order) do mock_model Spree::Order, backordered?: false,
                  Severity: Major
                  Found in core/spec/models/spree/shipment_spec.rb - About 1 day to fix

                    File orders_controller_spec.rb has 583 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    require 'spec_helper'
                    require 'spree/testing_support/bar_ability'
                    
                    module Spree
                      describe Api::V1::OrdersController, type: :controller do
                    Severity: Major
                    Found in api/spec/controllers/spree/api/v1/orders_controller_spec.rb - About 1 day to fix

                      File checkout_spec.rb has 576 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      require 'spec_helper'
                      
                      describe 'Checkout', type: :feature, inaccessible: true, js: true do
                        include_context 'checkout setup'
                      
                      
                      Severity: Major
                      Found in frontend/spec/features/checkout_spec.rb - About 1 day to fix

                        File return_item_spec.rb has 572 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        require 'spec_helper'
                        
                        shared_examples 'an invalid state transition' do |status, expected_status|
                          let(:status) { status }
                        
                        
                        Severity: Major
                        Found in core/spec/models/spree/return_item_spec.rb - About 1 day to fix

                          File promotion_spec.rb has 565 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          require 'spec_helper'
                          
                          describe Spree::Promotion, type: :model do
                            let(:promotion) { Spree::Promotion.new }
                          
                          
                          Severity: Major
                          Found in core/spec/models/spree/promotion_spec.rb - About 1 day to fix

                            Method included has 239 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                  def self.included(klass)
                                    klass.class_eval do
                                      class_attribute :next_event_transitions
                                      class_attribute :previous_states
                                      class_attribute :checkout_flow
                            Severity: Major
                            Found in core/app/models/spree/order/checkout.rb - About 1 day to fix

                              File order_spec.rb has 524 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              require 'spec_helper'
                              
                              module Spree
                                module Core
                                  describe Importer::Order do
                              Severity: Major
                              Found in core/spec/lib/spree/core/importer/order_spec.rb - About 1 day to fix

                                File order.rb has 519 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                require 'spree/core/validators/email'
                                require 'spree/order/checkout'
                                
                                module Spree
                                  class Order < Spree::Base
                                Severity: Major
                                Found in core/app/models/spree/order.rb - About 1 day to fix

                                  File order_details_spec.rb has 505 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  require 'spec_helper'
                                  
                                  describe 'Order Details', type: :feature, js: true do
                                    let!(:stock_location) { create(:stock_location_with_items) }
                                    let!(:product) { create(:product, name: 'spree t-shirt', price: 20.00) }
                                  Severity: Major
                                  Found in backend/spec/features/admin/orders/order_details_spec.rb - About 1 day to fix

                                    File tax_rate_spec.rb has 478 lines of code (exceeds 250 allowed). Consider refactoring.
                                    Open

                                    require 'spec_helper'
                                    
                                    describe Spree::TaxRate, type: :model do
                                      context 'match' do
                                        let(:order) { create(:order) }
                                    Severity: Minor
                                    Found in core/spec/models/spree/tax_rate_spec.rb - About 7 hrs to fix

                                      File product_spec.rb has 475 lines of code (exceeds 250 allowed). Consider refactoring.
                                      Open

                                      require 'spec_helper'
                                      
                                      module ThirdParty
                                        class Extension < Spree::Base
                                          # nasty hack so we don't have to create a table to back this fake model
                                      Severity: Minor
                                      Found in core/spec/models/spree/product_spec.rb - About 7 hrs to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language