jquery/jquery

View on GitHub
external/sizzle/dist/sizzle.js

Summary

Maintainability
F
1 wk
Test Coverage

File sizzle.js has 1467 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!
 * Sizzle CSS Selector Engine v2.3.3
 * https://sizzlejs.com/
 *
 * Copyright jQuery Foundation and other contributors
Severity: Major
Found in external/sizzle/dist/sizzle.js - About 3 days to fix

    Function setDocument has 245 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    setDocument = Sizzle.setDocument = function( node ) {
        var hasCompare, subWindow,
            doc = node ? node.ownerDocument || node : preferredDoc;
    
        // Return early if doc is invalid or already selected
    Severity: Major
    Found in external/sizzle/dist/sizzle.js - About 1 day to fix

      Function CHILD has 80 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              "CHILD": function( type, what, argument, first, last ) {
                  var simple = type.slice( 0, 3 ) !== "nth",
                      forward = type.slice( -4 ) !== "last",
                      ofType = what === "of-type";
      
      
      Severity: Major
      Found in external/sizzle/dist/sizzle.js - About 3 hrs to fix

        Function Sizzle has 80 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function Sizzle( selector, context, results, seed ) {
            var m, i, elem, nid, match, groups, newSelector,
                newContext = context && context.ownerDocument,
        
                // nodeType defaults to 9, since context defaults to document
        Severity: Major
        Found in external/sizzle/dist/sizzle.js - About 3 hrs to fix

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

          function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
              var bySet = setMatchers.length > 0,
                  byElement = elementMatchers.length > 0,
                  superMatcher = function( seed, context, xml, results, outermost ) {
                      var elem, j, matcher,
          Severity: Major
          Found in external/sizzle/dist/sizzle.js - About 2 hrs to fix

            Consider simplifying this complex logical expression.
            Open

                                    if ( forward && useCache ) {
            
                                        // Seek `elem` from a previously-cached index
            
                                        // ...in a gzip-friendly way
            Severity: Critical
            Found in external/sizzle/dist/sizzle.js - About 2 hrs to fix

              Function setMatcher has 66 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
                  if ( postFilter && !postFilter[ expando ] ) {
                      postFilter = setMatcher( postFilter );
                  }
                  if ( postFinder && !postFinder[ expando ] ) {
              Severity: Major
              Found in external/sizzle/dist/sizzle.js - About 2 hrs to fix

                Function superMatcher has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        superMatcher = function( seed, context, xml, results, outermost ) {
                            var elem, j, matcher,
                                matchedCount = 0,
                                i = "0",
                                unmatched = seed && [],
                Severity: Major
                Found in external/sizzle/dist/sizzle.js - About 2 hrs to fix

                  Function select has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  select = Sizzle.select = function( selector, context, results, seed ) {
                      var i, tokens, token, type, find,
                          compiled = typeof selector === "function" && selector,
                          match = !seed && tokenize( (selector = compiled.selector || selector) );
                  
                  
                  Severity: Minor
                  Found in external/sizzle/dist/sizzle.js - About 1 hr to fix

                    Function addCombinator has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function addCombinator( matcher, combinator, base ) {
                        var dir = combinator.dir,
                            skip = combinator.next,
                            key = skip || dir,
                            checkNonElements = base && key === "parentNode",
                    Severity: Minor
                    Found in external/sizzle/dist/sizzle.js - About 1 hr to fix

                      Function matcherFromTokens has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function matcherFromTokens( tokens ) {
                          var checkContext, matcher, j,
                              len = tokens.length,
                              leadingRelative = Expr.relative[ tokens[0].type ],
                              implicitRelative = leadingRelative || Expr.relative[" "],
                      Severity: Minor
                      Found in external/sizzle/dist/sizzle.js - About 1 hr to fix

                        Function tokenize has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
                            var matched, match, tokens, type,
                                soFar, groups, preFilters,
                                cached = tokenCache[ selector + " " ];
                        
                        
                        Severity: Minor
                        Found in external/sizzle/dist/sizzle.js - About 1 hr to fix

                          Consider simplifying this complex logical expression.
                          Open

                              if ( support.matchesSelector && documentIsHTML &&
                                  !compilerCache[ expr + " " ] &&
                                  ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
                                  ( !rbuggyQSA     || !rbuggyQSA.test( expr ) ) ) {
                          
                          
                          Severity: Major
                          Found in external/sizzle/dist/sizzle.js - About 1 hr to fix

                            Avoid deeply nested control flow statements.
                            Open

                                            } else if ( match[2] ) {
                                                push.apply( results, context.getElementsByTagName( selector ) );
                                                return results;
                            
                                            // Class selector
                            Severity: Major
                            Found in external/sizzle/dist/sizzle.js - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                          if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
                                                              return true;
                                                          }
                              Severity: Major
                              Found in external/sizzle/dist/sizzle.js - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                    while ( i-- ) {
                                                        groups[i] = "#" + nid + " " + toSelector( groups[i] );
                                                    }
                                Severity: Major
                                Found in external/sizzle/dist/sizzle.js - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                                      if ( ofType ?
                                                                          node.nodeName.toLowerCase() === name :
                                                                          node.nodeType === 1 ) {
                                  
                                                                          return false;
                                  Severity: Major
                                  Found in external/sizzle/dist/sizzle.js - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                        if ( (nid = context.getAttribute( "id" )) ) {
                                                            nid = nid.replace( rcssescape, fcssescape );
                                                        } else {
                                                            context.setAttribute( "id", (nid = expando) );
                                                        }
                                    Severity: Major
                                    Found in external/sizzle/dist/sizzle.js - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                                  if ( !(unmatched[i] || setMatched[i]) ) {
                                                                      setMatched[i] = pop.call( results );
                                                                  }
                                      Severity: Major
                                      Found in external/sizzle/dist/sizzle.js - About 45 mins to fix

                                        Avoid deeply nested control flow statements.
                                        Open

                                                                if ( nid === expando ) {
                                                                    context.removeAttribute( "id" );
                                                                }
                                        Severity: Major
                                        Found in external/sizzle/dist/sizzle.js - About 45 mins to fix

                                          Avoid deeply nested control flow statements.
                                          Open

                                                              if ( Expr.relative[ tokens[j].type ] ) {
                                                                  break;
                                                              }
                                          Severity: Major
                                          Found in external/sizzle/dist/sizzle.js - About 45 mins to fix

                                            Avoid deeply nested control flow statements.
                                            Open

                                                                    if ( (elem = matcherOut[i]) ) {
                                                                        // Restore matcherIn since elem is not yet a final match
                                                                        temp.push( (matcherIn[i] = elem) );
                                                                    }
                                            Severity: Major
                                            Found in external/sizzle/dist/sizzle.js - About 45 mins to fix

                                              Avoid deeply nested control flow statements.
                                              Open

                                                                      if ( node && node.value === id ) {
                                                                          return [ elem ];
                                                                      }
                                              Severity: Major
                                              Found in external/sizzle/dist/sizzle.js - About 45 mins to fix

                                                Avoid deeply nested control flow statements.
                                                Open

                                                                                    if ( ( ofType ?
                                                                                        node.nodeName.toLowerCase() === name :
                                                                                        node.nodeType === 1 ) &&
                                                                                        ++diff ) {
                                                
                                                
                                                Severity: Major
                                                Found in external/sizzle/dist/sizzle.js - About 45 mins to fix

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

                                                  function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
                                                  Severity: Minor
                                                  Found in external/sizzle/dist/sizzle.js - About 45 mins to fix

                                                    Avoid deeply nested control flow statements.
                                                    Open

                                                                        if ( !selector ) {
                                                                            push.apply( results, seed );
                                                                            return results;
                                                                        }
                                                    Severity: Major
                                                    Found in external/sizzle/dist/sizzle.js - About 45 mins to fix

                                                      Avoid deeply nested control flow statements.
                                                      Open

                                                                          if ( nodeType === 9 ) {
                                                                              if ( (elem = context.getElementById( m )) ) {
                                                      
                                                                                  // Support: IE, Opera, Webkit
                                                                                  // TODO: identify versions
                                                      Severity: Major
                                                      Found in external/sizzle/dist/sizzle.js - About 45 mins to fix

                                                        Consider simplifying this complex logical expression.
                                                        Open

                                                                if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
                                                                        context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
                                                        
                                                                    context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
                                                                    if ( !context ) {
                                                        Severity: Major
                                                        Found in external/sizzle/dist/sizzle.js - About 40 mins to fix

                                                          Consider simplifying this complex logical expression.
                                                          Open

                                                                      if ( matcher[ expando ] ) {
                                                                          // Find the next relative operator (if any) for proper handling
                                                                          j = ++i;
                                                                          for ( ; j < len; j++ ) {
                                                                              if ( Expr.relative[ tokens[j].type ] ) {
                                                          Severity: Major
                                                          Found in external/sizzle/dist/sizzle.js - About 40 mins to fix

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

                                                            function condense( unmatched, map, filter, context, xml ) {
                                                            Severity: Minor
                                                            Found in external/sizzle/dist/sizzle.js - About 35 mins to fix

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

                                                                      "CHILD": function( type, what, argument, first, last ) {
                                                              Severity: Minor
                                                              Found in external/sizzle/dist/sizzle.js - About 35 mins to fix

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

                                                                        superMatcher = function( seed, context, xml, results, outermost ) {
                                                                Severity: Minor
                                                                Found in external/sizzle/dist/sizzle.js - About 35 mins to fix

                                                                  Avoid too many return statements within this function.
                                                                  Open

                                                                              return elem.disabled === disabled;
                                                                  Severity: Major
                                                                  Found in external/sizzle/dist/sizzle.js - About 30 mins to fix

                                                                    Avoid too many return statements within this function.
                                                                    Open

                                                                        return select( selector.replace( rtrim, "$1" ), context, results, seed );
                                                                    Severity: Major
                                                                    Found in external/sizzle/dist/sizzle.js - About 30 mins to fix

                                                                      Avoid too many return statements within this function.
                                                                      Open

                                                                              return false;
                                                                      Severity: Major
                                                                      Found in external/sizzle/dist/sizzle.js - About 30 mins to fix

                                                                        Avoid too many return statements within this function.
                                                                        Open

                                                                                    return sortInput ?
                                                                                        ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
                                                                                        0;
                                                                        Severity: Major
                                                                        Found in external/sizzle/dist/sizzle.js - About 30 mins to fix

                                                                          Avoid too many return statements within this function.
                                                                          Open

                                                                                                  return results;
                                                                          Severity: Major
                                                                          Found in external/sizzle/dist/sizzle.js - About 30 mins to fix

                                                                            Avoid too many return statements within this function.
                                                                            Open

                                                                                                return results;
                                                                            Severity: Major
                                                                            Found in external/sizzle/dist/sizzle.js - About 30 mins to fix

                                                                              Avoid too many return statements within this function.
                                                                              Open

                                                                                      return compare & 4 ? -1 : 1;
                                                                              Severity: Major
                                                                              Found in external/sizzle/dist/sizzle.js - About 30 mins to fix

                                                                                Avoid too many return statements within this function.
                                                                                Open

                                                                                                    return results;
                                                                                Severity: Major
                                                                                Found in external/sizzle/dist/sizzle.js - About 30 mins to fix

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

                                                                                      fcssescape = function( ch, asCodePoint ) {
                                                                                          if ( asCodePoint ) {
                                                                                  
                                                                                              // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
                                                                                              if ( ch === "\0" ) {
                                                                                  Severity: Major
                                                                                  Found in external/sizzle/dist/sizzle.js and 1 other location - About 3 hrs to fix
                                                                                  src/selector-native.js on lines 47..61

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

                                                                                  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 ( hasDuplicate ) {
                                                                                          while ( (elem = results[i++]) ) {
                                                                                              if ( elem === results[ i ] ) {
                                                                                                  j = duplicates.push( i );
                                                                                              }
                                                                                  Severity: Major
                                                                                  Found in external/sizzle/dist/sizzle.js and 1 other location - About 2 hrs to fix
                                                                                  src/selector-native.js on lines 116..125

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

                                                                                  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

                                                                                          "even": createPositionalPseudo(function( matchIndexes, length ) {
                                                                                              var i = 0;
                                                                                              for ( ; i < length; i += 2 ) {
                                                                                                  matchIndexes.push( i );
                                                                                              }
                                                                                  Severity: Minor
                                                                                  Found in external/sizzle/dist/sizzle.js and 1 other location - About 55 mins to fix
                                                                                  external/sizzle/dist/sizzle.js on lines 1591..1597

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

                                                                                  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

                                                                                          "odd": createPositionalPseudo(function( matchIndexes, length ) {
                                                                                              var i = 1;
                                                                                              for ( ; i < length; i += 2 ) {
                                                                                                  matchIndexes.push( i );
                                                                                              }
                                                                                  Severity: Minor
                                                                                  Found in external/sizzle/dist/sizzle.js and 1 other location - About 55 mins to fix
                                                                                  external/sizzle/dist/sizzle.js on lines 1583..1589

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

                                                                                  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

                                                                                  isXML = Sizzle.isXML = function( elem ) {
                                                                                      // documentElement is verified for cases where it doesn't yet exist
                                                                                      // (such as loading iframes in IE - #4833)
                                                                                      var documentElement = elem && (elem.ownerDocument || elem).documentElement;
                                                                                      return documentElement ? documentElement.nodeName !== "HTML" : false;
                                                                                  Severity: Minor
                                                                                  Found in external/sizzle/dist/sizzle.js and 1 other location - About 45 mins to fix
                                                                                  src/selector-native.js on lines 202..208

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

                                                                                  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

                                                                                          compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
                                                                                              a.compareDocumentPosition( b ) :
                                                                                  
                                                                                              // Otherwise we know they are disconnected
                                                                                              1;
                                                                                  Severity: Minor
                                                                                  Found in external/sizzle/dist/sizzle.js and 1 other location - About 35 mins to fix
                                                                                  src/selector-native.js on lines 78..82

                                                                                  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

                                                                                  There are no issues that match your filters.

                                                                                  Category
                                                                                  Status