CyclicMaterials/cycle-hammer-driver

View on GitHub

Showing 16 of 60 total issues

Function 1 has 1376 lines of code (exceeds 25 allowed). Consider refactoring.
Open

(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.CycleHammer = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
/*! Hammer.JS - v2.0.4 - 2014-09-28
 * http://hammerjs.github.io/
 *
 * Copyright (c) 2014 Jorik Tangelder;
Severity: Major
Found in dist/cycle-hammer.js - About 6 days to fix

    File cycle-hammer.js has 1718 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.CycleHammer = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
    /*! Hammer.JS - v2.0.4 - 2014-09-28
     * http://hammerjs.github.io/
     *
     * Copyright (c) 2014 Jorik Tangelder;
    Severity: Major
    Found in dist/cycle-hammer.js - About 4 days to fix

      Function 6 has 174 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      },{"./hammerDriver":4}],6:[function(require,module,exports){
      /**
       * @fileoverview Standard Event Types
       * @author Frederik Krautwald
       * @copyright 2015 Cyclic Materials. All rights reserved.
      Severity: Major
      Found in dist/cycle-hammer.js - About 6 hrs to fix

        Function 3 has 75 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        },{"./makeHammerDriver":5}],3:[function(require,module,exports){
        (function (global){
        /**
         * @fileoverview Observable from Hammer Event
         * @author Frederik Krautwald
        Severity: Major
        Found in dist/cycle-hammer.js - About 3 hrs to fix

          Function 4 has 57 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          },{"hammerjs":1}],4:[function(require,module,exports){
          (function (global){
          /**
           * @fileoverview Hammer driver
           * @author Frederik Krautwald
          Severity: Major
          Found in dist/cycle-hammer.js - About 2 hrs to fix

            Function getTouches has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function getTouches(ev, type) {
                var allTouches = toArray(ev.touches);
                var targetIds = this.targetIds;
            
                // when there is only one touch, the process can be simplified
            Severity: Minor
            Found in dist/cycle-hammer.js - About 1 hr to fix

              Function process has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  process: function(input) {
                      var options = this.options;
              
                      var validPointers = input.pointers.length === options.pointers;
                      var validMovement = input.distance < options.threshold;
              Severity: Minor
              Found in dist/cycle-hammer.js - About 1 hr to fix

                Function computeInputData has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function computeInputData(manager, input) {
                    var session = manager.session;
                    var pointers = input.pointers;
                    var pointersLength = pointers.length;
                
                
                Severity: Minor
                Found in dist/cycle-hammer.js - About 1 hr to fix

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

                      handler: function PEhandler(ev) {
                          var store = this.store;
                          var removePointer = false;
                  
                          var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');
                  Severity: Minor
                  Found in dist/cycle-hammer.js - About 1 hr to fix

                    Function recognize has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        recognize: function(inputData) {
                            var session = this.session;
                            if (session.stopped) {
                                return;
                            }
                    Severity: Minor
                    Found in dist/cycle-hammer.js - About 1 hr to fix

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

                      function makeEventsSelector(api, originalEvents) {
                        return function events(eventType) {
                          for (var _len = arguments.length, rest = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
                            rest[_key - 1] = arguments[_key];
                          }
                      Severity: Minor
                      Found in lib/hammerDriver.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

                      Avoid too many return statements within this function.
                      Open

                          return '';
                      Severity: Major
                      Found in dist/cycle-hammer.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                return STATE_FAILED;
                        Severity: Major
                        Found in dist/cycle-hammer.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                              return '';
                          Severity: Major
                          Found in dist/cycle-hammer.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                return TOUCH_ACTION_AUTO;
                            Severity: Major
                            Found in dist/cycle-hammer.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                      return STATE_FAILED;
                              Severity: Major
                              Found in dist/cycle-hammer.js - About 30 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language