breunigs/hipsterpizza

View on GitHub

Showing 19 of 19 total issues

Function hipster has a Cognitive Complexity of 128 (exceeds 5 allowed). Consider refactoring.
Open

var hipster = window.hipster = (function() {
  'use strict';

  var my = HIPSTER;

Severity: Minor
Found in app/assets/javascripts/pizzade.js - About 2 days 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

Function hipster has 510 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var hipster = window.hipster = (function() {
  'use strict';

  var my = HIPSTER;

Severity: Major
Found in app/assets/javascripts/pizzade.js - About 2 days to fix

    File pizzade.js has 526 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    //= require jquery_ujs
    //= require _both
    //= require bootstrap/dropdown
    //= require bootstrap/collapse
    //= require _static_tools
    Severity: Major
    Found in app/assets/javascripts/pizzade.js - About 1 day to fix

      Function replay has 183 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function replay(items, finishCallback) {
          // setup
          my.log('replay: setup started');
          $.fx.off = true;
          $('body').addClass('wait');
      Severity: Major
      Found in app/assets/javascripts/pizzade.js - About 7 hrs to fix

        Class Basket has 22 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class Basket < ActiveRecord::Base
          extend FriendlyId
          friendly_id :uid
        
          has_many :orders, dependent: :destroy
        Severity: Minor
        Found in app/models/basket.rb - About 2 hrs to fix

          Function addItemsToBasket has 53 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function addItemsToBasket() {
                my.log('replay: searching page “' + getActiveSubPageText() + '” for items');
          
                items = $.grep(items, function (item, ind) {
                  // Deposit is added automatically when selecting the correct products
          Severity: Major
          Found in app/assets/javascripts/pizzade.js - About 2 hrs to fix

            Function HIPSTER has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

            var HIPSTER = (function (my) {
              'use strict';
            
              // PRIVATE ///////////////////////////////////////////////////////////////////
              // PUBLIC ////////////////////////////////////////////////////////////////////
            Severity: Minor
            Found in app/assets/javascripts/_static_tools.js - About 1 hr 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

            Function HIPSTER has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            var HIPSTER = (function (my) {
              'use strict';
            
              // PRIVATE ///////////////////////////////////////////////////////////////////
            
            
            Severity: Minor
            Found in app/assets/javascripts/_cookie.js - About 1 hr to fix

              Function replayData has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  replayData: function() {
                    var data = window.hipsterReplayData;
                    var mode = window.hipsterReplayMode;
                    if(typeof data === 'undefined' || data === null) {
                      return;
              Severity: Minor
              Found in app/assets/javascripts/pizzade.js - About 1 hr to fix

                Function HIPSTER has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                var HIPSTER = (function (my) {
                  'use strict';
                
                  // PRIVATE ///////////////////////////////////////////////////////////////////
                
                
                Severity: Minor
                Found in app/assets/javascripts/_cookie.js - About 1 hr 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

                Function HIPSTER has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                var HIPSTER = (function (my) {
                  'use strict';
                
                  // PRIVATE ///////////////////////////////////////////////////////////////////
                  // PUBLIC ////////////////////////////////////////////////////////////////////
                Severity: Minor
                Found in app/assets/javascripts/_static_tools.js - About 1 hr to fix

                  Method create_uid has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def create_uid
                      raise "Basket has already an UID"  if self.uid
                  
                      other = Basket.pluck(:uid)
                  
                  
                  Severity: Minor
                  Found in app/models/basket.rb - About 45 mins 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

                  Function HIPSTER has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  var HIPSTER = (function (my) {
                    'use strict';
                  
                    my.Watchdog = function(timeout, callback) {
                      if(typeof(callback) !== 'function') {
                  Severity: Minor
                  Found in app/assets/javascripts/_watchdog.js - About 35 mins 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

                  Method cookie_set has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def cookie_set(key, value, perma = true)
                      key = key.to_s
                      raise "invalid cookie key: #{key}" unless cookie_valid_key?(key)
                  
                      key = "_hipsterpizza_#{key}"
                  Severity: Minor
                  Found in app/helpers/cookie_helper.rb - About 35 mins 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

                  Method new has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def new
                      # if there’s an editable basket and we are in single basket mode,
                      # redirect directly to basket instead of creating new one
                      if PINNING['single_basket_mode']
                        @basket = Basket.find_editable
                  Severity: Minor
                  Found in app/controllers/basket_controller.rb - About 35 mins 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

                  Method contact_details_array has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def contact_details_array
                      def get(f)
                        contact_field(f) || ''
                      end
                  
                  
                  Severity: Minor
                  Found in app/helpers/basket_helper.rb - About 25 mins 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

                  Method destroy has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def destroy
                      unless view_context.my_order? || view_context.admin?
                        flash[:warn] = I18n.t('order.controller.destroy.admin_required')
                        return redirect_to @basket
                      end
                  Severity: Minor
                  Found in app/controllers/order_controller.rb - About 25 mins 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

                  Method find_basket has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def find_basket
                      basket_id = params[:basket_id] || params[:id]
                  
                      @basket ||= Basket.friendly.find(basket_id.downcase) rescue nil
                      # if there’s an id, but it’s invalid it should ignore the cookie. This
                  Severity: Minor
                  Found in app/controllers/application_controller.rb - About 25 mins 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

                  Method update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def update
                      old_pay     = @order.paid? ? @order.sum : 0
                      old_pay_tip = @order.paid? ? @order.sum_with_tip : 0
                  
                      @order.json = params[:json]
                  Severity: Minor
                  Found in app/controllers/order_controller.rb - About 25 mins 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

                  Severity
                  Category
                  Status
                  Source
                  Language