concord-consortium/lara

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

Summary

Maintainability
F
1 wk
Test Coverage

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

/*! Hammer.JS - v2.0.4 - 2014-09-28
 * http://hammerjs.github.io/
 *
 * Copyright (c) 2014 Jorik Tangelder;
 * Licensed under the MIT license */
Severity: Major
Found in app/assets/javascripts/hammer.js - About 3 days 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 app/assets/javascripts/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 app/assets/javascripts/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 app/assets/javascripts/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 app/assets/javascripts/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 app/assets/javascripts/hammer.js - About 1 hr to fix

              Avoid too many return statements within this function.
              Open

                      return STATE_FAILED;
              Severity: Major
              Found in app/assets/javascripts/hammer.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return TOUCH_ACTION_AUTO;
                Severity: Major
                Found in app/assets/javascripts/hammer.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                      return '';
                  Severity: Major
                  Found in app/assets/javascripts/hammer.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                        return '';
                    Severity: Major
                    Found in app/assets/javascripts/hammer.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return STATE_FAILED;
                      Severity: Major
                      Found in app/assets/javascripts/hammer.js - About 30 mins to fix

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                            init: function() {
                                this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);
                                this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);
                                this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);
                            },
                        Severity: Major
                        Found in app/assets/javascripts/hammer.js and 1 other location - About 3 hrs to fix
                        app/assets/javascripts/hammer.js on lines 403..407

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 103.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                            destroy: function() {
                                this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);
                                this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);
                                this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);
                            }
                        Severity: Major
                        Found in app/assets/javascripts/hammer.js and 1 other location - About 3 hrs to fix
                        app/assets/javascripts/hammer.js on lines 394..398

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 103.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                        function stateStr(state) {
                            if (state & STATE_CANCELLED) {
                                return 'cancel';
                            } else if (state & STATE_ENDED) {
                                return 'end';
                        Severity: Major
                        Found in app/assets/javascripts/hammer.js and 1 other location - About 2 hrs to fix
                        app/assets/javascripts/hammer.js on lines 1513..1524

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 75.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                        function directionStr(direction) {
                            if (direction == DIRECTION_DOWN) {
                                return 'down';
                            } else if (direction == DIRECTION_UP) {
                                return 'up';
                        Severity: Major
                        Found in app/assets/javascripts/hammer.js and 1 other location - About 2 hrs to fix
                        app/assets/javascripts/hammer.js on lines 1495..1506

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 75.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                                    if (options.direction & DIRECTION_HORIZONTAL) {
                                        direction = (x === 0) ? DIRECTION_NONE : (x < 0) ? DIRECTION_LEFT : DIRECTION_RIGHT;
                                        hasMoved = x != this.pX;
                                        distance = Math.abs(input.deltaX);
                                    } else {
                        Severity: Major
                        Found in app/assets/javascripts/hammer.js and 1 other location - About 1 hr to fix
                        app/assets/javascripts/hammer.js on lines 1652..1656

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 64.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                                    } else {
                                        direction = (y === 0) ? DIRECTION_NONE : (y < 0) ? DIRECTION_UP : DIRECTION_DOWN;
                                        hasMoved = y != this.pY;
                                        distance = Math.abs(input.deltaY);
                                    }
                        Severity: Major
                        Found in app/assets/javascripts/hammer.js and 1 other location - About 1 hr to fix
                        app/assets/javascripts/hammer.js on lines 1648..1652

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 64.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                            var x = p2[props[0]] - p1[props[0]],
                                y = p2[props[1]] - p1[props[1]];
                        Severity: Minor
                        Found in app/assets/javascripts/hammer.js and 1 other location - About 50 mins to fix
                        app/assets/javascripts/hammer.js on lines 671..672

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 52.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                            var x = p2[props[0]] - p1[props[0]],
                                y = p2[props[1]] - p1[props[1]];
                        Severity: Minor
                        Found in app/assets/javascripts/hammer.js and 1 other location - About 50 mins to fix
                        app/assets/javascripts/hammer.js on lines 688..689

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 52.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                                            this._timer = setTimeoutContext(function() {
                                                this.state = STATE_RECOGNIZED;
                                                this.tryEmit();
                                            }, options.interval, this);
                        Severity: Minor
                        Found in app/assets/javascripts/hammer.js and 1 other location - About 35 mins to fix
                        app/assets/javascripts/hammer.js on lines 1762..1765

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 47.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                                    this._timer = setTimeoutContext(function() {
                                        this.state = STATE_RECOGNIZED;
                                        this.tryEmit();
                                    }, options.time, this);
                        Severity: Minor
                        Found in app/assets/javascripts/hammer.js and 1 other location - About 35 mins to fix
                        app/assets/javascripts/hammer.js on lines 1961..1964

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 47.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                                this.callback(this.manager, type, {
                                    pointers: touches[0],
                                    changedPointers: touches[1],
                                    pointerType: INPUT_TYPE_TOUCH,
                                    srcEvent: ev
                        Severity: Minor
                        Found in app/assets/javascripts/hammer.js and 1 other location - About 35 mins to fix
                        app/assets/javascripts/hammer.js on lines 905..910

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 46.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                        function addEventListeners(target, types, handler) {
                            each(splitStr(types), function(type) {
                                target.addEventListener(type, handler, false);
                            });
                        }
                        Severity: Minor
                        Found in app/assets/javascripts/hammer.js and 1 other location - About 35 mins to fix
                        app/assets/javascripts/hammer.js on lines 178..182

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 46.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                                this.callback(this.manager, type, {
                                    pointers: touches[0],
                                    changedPointers: touches[1],
                                    pointerType: INPUT_TYPE_TOUCH,
                                    srcEvent: ev
                        Severity: Minor
                        Found in app/assets/javascripts/hammer.js and 1 other location - About 35 mins to fix
                        app/assets/javascripts/hammer.js on lines 960..965

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 46.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                        function removeEventListeners(target, types, handler) {
                            each(splitStr(types), function(type) {
                                target.removeEventListener(type, handler, false);
                            });
                        }
                        Severity: Minor
                        Found in app/assets/javascripts/hammer.js and 1 other location - About 35 mins to fix
                        app/assets/javascripts/hammer.js on lines 166..170

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 46.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        There are no issues that match your filters.

                        Category
                        Status