breunigs/hipsterpizza

View on GitHub
app/assets/javascripts/pizzade.js

Summary

Maintainability
F
1 wk
Test Coverage

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

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

            There are no issues that match your filters.

            Category
            Status