bronycub/sugarcub

View on GitHub
core/static/vendor/jquery/src/event.js

Summary

Maintainability
F
1 mo
Test Coverage

File event.js has 519 lines of code (exceeds 250 allowed). Consider refactoring.
Open

define( [
    "./core",
    "./var/document",
    "./var/documentElement",
    "./var/rnothtmlwhite",
Severity: Major
Found in core/static/vendor/jquery/src/event.js - About 1 day to fix

    Function add has 72 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        add: function( elem, types, handler, data, selector ) {
    
            var handleObjIn, eventHandle, tmp,
                events, t, handleObj,
                special, handlers, type, namespaces, origType,
    Severity: Major
    Found in core/static/vendor/jquery/src/event.js - About 2 hrs to fix

      Function remove has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          remove: function( elem, types, handler, selector, mappedTypes ) {
      
              var j, origCount, tmp,
                  events, t, handleObj,
                  special, handlers, type, namespaces, origType,
      Severity: Major
      Found in core/static/vendor/jquery/src/event.js - About 2 hrs to fix

        Consider simplifying this complex logical expression.
        Open

                        if ( ( mappedTypes || origType === handleObj.origType ) &&
                            ( !handler || handler.guid === handleObj.guid ) &&
                            ( !tmp || tmp.test( handleObj.namespace ) ) &&
                            ( !selector || selector === handleObj.selector ||
                                selector === "**" && handleObj.selector ) ) {
        Severity: Critical
        Found in core/static/vendor/jquery/src/event.js - About 2 hrs to fix

          Function on has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function on( elem, types, selector, data, fn, one ) {
              var origFn, type;
          
              // Types can be a map of types/handlers
              if ( typeof types === "object" ) {
          Severity: Minor
          Found in core/static/vendor/jquery/src/event.js - About 1 hr to fix

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

                dispatch: function( nativeEvent ) {
            
                    // Make a writable jQuery.Event from the native event object
                    var event = jQuery.event.fix( nativeEvent );
            
            
            Severity: Minor
            Found in core/static/vendor/jquery/src/event.js - About 1 hr to fix

              Function handlers has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  handlers: function( event, handlers ) {
                      var i, handleObj, sel, matchedHandlers, matchedSelectors,
                          handlerQueue = [],
                          delegateCount = handlers.delegateCount,
                          cur = event.target;
              Severity: Minor
              Found in core/static/vendor/jquery/src/event.js - About 1 hr to fix

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

                    off: function( types, selector, fn ) {
                        var handleObj, type;
                        if ( types && types.preventDefault && types.handleObj ) {
                
                            // ( event )  dispatched jQuery.Event
                Severity: Minor
                Found in core/static/vendor/jquery/src/event.js - About 1 hr to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if ( ( event.result = ret ) === false ) {
                                              event.preventDefault();
                                              event.stopPropagation();
                                          }
                  Severity: Major
                  Found in core/static/vendor/jquery/src/event.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if ( matchedSelectors[ sel ] === undefined ) {
                                                matchedSelectors[ sel ] = handleObj.needsContext ?
                                                    jQuery( sel, this ).index( cur ) > -1 :
                                                    jQuery.find( sel, this, null, [ cur ] ).length;
                                            }
                    Severity: Major
                    Found in core/static/vendor/jquery/src/event.js - About 45 mins to fix

                      Function on has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      function on( elem, types, selector, data, fn, one ) {
                      Severity: Minor
                      Found in core/static/vendor/jquery/src/event.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                if ( matchedSelectors[ sel ] ) {
                                                    matchedHandlers.push( handleObj );
                                                }
                        Severity: Major
                        Found in core/static/vendor/jquery/src/event.js - About 45 mins to fix

                          Function add has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              add: function( elem, types, handler, data, selector ) {
                          Severity: Minor
                          Found in core/static/vendor/jquery/src/event.js - About 35 mins to fix

                            Function remove has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                remove: function( elem, types, handler, selector, mappedTypes ) {
                            Severity: Minor
                            Found in core/static/vendor/jquery/src/event.js - About 35 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                      return event.which;
                              Severity: Major
                              Found in core/static/vendor/jquery/src/event.js - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                            return 0;
                                Severity: Major
                                Found in core/static/vendor/jquery/src/event.js - About 30 mins to fix

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

                                  jQuery.event = {
                                  
                                      global: {},
                                  
                                      add: function( elem, types, handler, data, selector ) {
                                  Severity: Major
                                  Found in core/static/vendor/jquery/src/event.js and 2 other locations - About 2 wks to fix
                                  core/static/vendor/jquery/dist/jquery.js on lines 4965..5366
                                  core/static/vendor/jquery/dist/jquery.slim.js on lines 4965..5366

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

                                  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 3 locations. Consider refactoring.
                                  Open

                                  function on( elem, types, selector, data, fn, one ) {
                                      var origFn, type;
                                  
                                      // Types can be a map of types/handlers
                                      if ( typeof types === "object" ) {
                                  Severity: Major
                                  Found in core/static/vendor/jquery/src/event.js and 2 other locations - About 2 days to fix
                                  core/static/vendor/jquery/dist/jquery.js on lines 4900..4959
                                  core/static/vendor/jquery/dist/jquery.slim.js on lines 4900..4959

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

                                  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 3 locations. Consider refactoring.
                                  Open

                                  jQuery.each( {
                                      altKey: true,
                                      bubbles: true,
                                      cancelable: true,
                                      changedTouches: true,
                                  Severity: Major
                                  Found in core/static/vendor/jquery/src/event.js and 2 other locations - About 1 day to fix
                                  core/static/vendor/jquery/dist/jquery.js on lines 5466..5524
                                  core/static/vendor/jquery/dist/jquery.slim.js on lines 5466..5524

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

                                  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 3 locations. Consider refactoring.
                                  Open

                                  jQuery.Event = function( src, props ) {
                                  
                                      // Allow instantiation without the 'new' keyword
                                      if ( !( this instanceof jQuery.Event ) ) {
                                          return new jQuery.Event( src, props );
                                  Severity: Major
                                  Found in core/static/vendor/jquery/src/event.js and 2 other locations - About 1 day to fix
                                  core/static/vendor/jquery/dist/jquery.js on lines 5376..5423
                                  core/static/vendor/jquery/dist/jquery.slim.js on lines 5376..5423

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

                                  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 3 locations. Consider refactoring.
                                  Open

                                  jQuery.fn.extend( {
                                  
                                      on: function( types, selector, data, fn ) {
                                          return on( this, types, selector, data, fn );
                                      },
                                  Severity: Major
                                  Found in core/static/vendor/jquery/src/event.js and 2 other locations - About 1 day to fix
                                  core/static/vendor/jquery/dist/jquery.js on lines 5562..5606
                                  core/static/vendor/jquery/dist/jquery.slim.js on lines 5562..5606

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

                                  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 3 locations. Consider refactoring.
                                  Open

                                  jQuery.Event.prototype = {
                                      constructor: jQuery.Event,
                                      isDefaultPrevented: returnFalse,
                                      isPropagationStopped: returnFalse,
                                      isImmediatePropagationStopped: returnFalse,
                                  Severity: Major
                                  Found in core/static/vendor/jquery/src/event.js and 2 other locations - About 1 day to fix
                                  core/static/vendor/jquery/dist/jquery.js on lines 5427..5463
                                  core/static/vendor/jquery/dist/jquery.slim.js on lines 5427..5463

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

                                  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 3 locations. Consider refactoring.
                                  Open

                                  jQuery.each( {
                                      mouseenter: "mouseover",
                                      mouseleave: "mouseout",
                                      pointerenter: "pointerover",
                                      pointerleave: "pointerout"
                                  Severity: Major
                                  Found in core/static/vendor/jquery/src/event.js and 2 other locations - About 1 day to fix
                                  core/static/vendor/jquery/dist/jquery.js on lines 5534..5560
                                  core/static/vendor/jquery/dist/jquery.slim.js on lines 5534..5560

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

                                  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