jquery/jquery

View on GitHub

Showing 255 of 255 total issues

Function load has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

jQuery.fn.load = function( url, params, callback ) {
    var selector, type, response,
        self = this,
        off = url.indexOf( " " );

Severity: Minor
Found in src/ajax/load.js - About 1 hr to fix

    Function makeArchive has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function makeArchive( cdn, files, callback ) {
            if ( Release.preRelease ) {
                console.log( "Skipping archive creation for " + cdn + "; this is a beta release." );
                callback();
                return;
    Severity: Minor
    Found in build/release/cdn.js - About 1 hr to fix

      Function removeClass has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          removeClass: function( value ) {
              var classes, elem, cur, curValue, clazz, j, finalValue,
                  i = 0;
      
              if ( typeof value === "function" ) {
      Severity: Minor
      Found in src/attributes/classes.js - About 1 hr to fix

        Function speed has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        jQuery.speed = function( speed, easing, fn ) {
            var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
                complete: fn || !fn && easing ||
                    typeof speed === "function" && speed,
                duration: speed,
        Severity: Minor
        Found in src/effects.js - About 1 hr to fix

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

              preventDefault: function() {
                  var e = this.originalEvent;
          
                  this.isDefaultPrevented = returnTrue;
          
          
          Severity: Major
          Found in src/event.js and 1 other location - About 1 hr to fix
          src/event.js on lines 672..680

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

          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

              stopPropagation: function() {
                  var e = this.originalEvent;
          
                  this.isPropagationStopped = returnTrue;
          
          
          Severity: Major
          Found in src/event.js and 1 other location - About 1 hr to fix
          src/event.js on lines 663..671

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

          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 ( typeof value === "function" ) {
                      return this.each( function( j ) {
                          jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
                      } );
                  }
          Severity: Major
          Found in src/attributes/classes.js and 1 other location - About 1 hr to fix
          src/attributes/classes.js on lines 30..34

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

          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 ( typeof value === "function" ) {
                      return this.each( function( j ) {
                          jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
                      } );
                  }
          Severity: Major
          Found in src/attributes/classes.js and 1 other location - About 1 hr to fix
          src/attributes/classes.js on lines 67..71

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

          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

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

              attr: function( elem, name, value ) {
                  var ret, hooks,
                      nType = elem.nodeType;
          
                  // Don't get/set attributes on text, comment and attribute nodes
          Severity: Minor
          Found in src/attributes/attr.js - About 1 hr to fix

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

                clone: function( elem, dataAndEvents, deepDataAndEvents ) {
                    var i, l, srcElements, destElements,
                        clone = elem.cloneNode( true ),
                        inPage = isAttached( elem );
            
            
            Severity: Minor
            Found in src/manipulation.js - About 1 hr to fix

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

                            object: function object(map, stack) {
                                var keys,
                                    key,
                                    val,
                                    i,
              Severity: Minor
              Found in external/qunit/qunit.js - About 1 hr to fix

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

                      before: function before() {
                          var _this = this;
                
                          var module = this.module,
                              notStartedModules = getNotStartedModules(module);
                Severity: Minor
                Found in external/qunit/qunit.js - About 1 hr to fix

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

                    function internalStart(test) {
                  
                        // If semaphore is non-numeric, throw error
                        if (isNaN(test.semaphore)) {
                            test.semaphore = 0;
                  Severity: Minor
                  Found in external/qunit/qunit.js - About 1 hr to fix

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

                          DiffMatchPatch.prototype.diffCommonOverlap = function (text1, text2) {
                              var text1Length, text2Length, textLength, best, length, pattern, found;
                    
                              // Cache the text lengths to prevent multiple calls.
                              text1Length = text1.length;
                    Severity: Minor
                    Found in external/qunit/qunit.js - About 1 hr to fix

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

                            pushResult: function pushResult(resultInfo) {
                                if (this !== config.current) {
                                    throw new Error("Assertion occurred after test had finished.");
                                }
                      
                      
                      Severity: Minor
                      Found in external/qunit/qunit.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 src/event.js - About 1 hr to fix

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

                              function copy() {
                          
                                  // Copy dist files
                                  var distFolder = Release.dir.dist + "/dist",
                                      externalFolder = Release.dir.dist + "/external",
                          Severity: Minor
                          Found in build/release/dist.js - About 1 hr to fix

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

                                finish: function( type ) {
                                    if ( type !== false ) {
                                        type = type || "fx";
                                    }
                                    return this.each( function() {
                            Severity: Minor
                            Found in src/effects.js - About 1 hr to fix

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

                                                  load.fromText = bind(this, function (text, textAlt) {
                                                      /*jslint evil: true */
                                                      var moduleName = map.name,
                                                          moduleMap = makeModuleMap(moduleName),
                                                          hasInteractive = useInteractive;
                              Severity: Minor
                              Found in external/requirejs/require.js - About 1 hr to fix

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

                                module.exports = function( grunt ) {
                                
                                    "use strict";
                                
                                    grunt.registerTask( "testswarm", function( commit, configFile, projectName, browserSets,
                                Severity: Minor
                                Found in build/tasks/testswarm.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

                                Severity
                                Category
                                Status
                                Source
                                Language