mjackson/mach

View on GitHub

Showing 200 of 382 total issues

Function sendRequest has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function sendRequest(conn, location) {
      return new AbortablePromise(function (resolve, reject, onAbort) {
        var xhr = new XMLHttpRequest();
        xhr.open(conn.method, location.href, true);

Severity: Minor
Found in lib/umd/mach.js - About 1 hr to fix

    Function serveApp has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function serveApp(app, options) {
      options = options || {};
    
      if (typeof options === 'number') {
        options = { port: options };
    Severity: Minor
    Found in modules/utils/serveApp.js - About 1 hr to fix

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

      function select( selector, context, results, seed, xml ) {
          var i, tokens, token, type, find,
              match = tokenize( selector ),
              j = match.length;
      
      
      Severity: Minor
      Found in modules/middleware/__tests__/fixtures/jquery-1.8.3.js - About 1 hr to fix

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

            removeData: function( elem, name, pvt /* Internal Use Only */ ) {
                if ( !jQuery.acceptData( elem ) ) {
                    return;
                }
        
        
        Severity: Minor
        Found in modules/middleware/__tests__/fixtures/jquery-1.8.3.js - About 1 hr to fix

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

                  "CHILD": function( type, argument, first, last ) {
          
                      if ( type === "nth" ) {
                          return function( elem ) {
                              var node, diff,
          Severity: Minor
          Found in modules/middleware/__tests__/fixtures/jquery-1.8.3.js - About 1 hr to fix

            Function emit has 45 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                EventEmitter.prototype.emit = function(type) {
                  var er, handler, len, args, i, listeners;
            
                  if (!this._events)
                    this._events = {};
            Severity: Minor
            Found in lib/umd/mach.js - About 1 hr to fix

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

              function addCombinator( matcher, combinator, base ) {
                  var dir = combinator.dir,
                      checkNonElements = base && combinator.dir === "parentNode",
                      doneName = done++;
              
              
              Severity: Minor
              Found in modules/middleware/__tests__/fixtures/jquery-1.8.3.js - About 1 hr to fix

                Function file has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                function file(app, options) {
                  // Allow mach.file(path|options)
                  if (typeof app === 'string' || typeof app === 'object') {
                    options = app;
                    app = null;
                Severity: Minor
                Found in modules/middleware/file.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

                Function createLocation has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                function createLocation(nodeRequest) {
                  var headers = nodeRequest.headers;
                
                  var protocol;
                  if (process.env.HTTPS === 'on' || headers['x-forwarded-ssl'] === 'on' || headers['font-end-https'] === 'on') {
                Severity: Minor
                Found in modules/utils/createConnection.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

                Function serveApp has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                function serveApp(app, options) {
                  options = options || {};
                
                  if (typeof options === 'number') {
                    options = { port: options };
                Severity: Minor
                Found in modules/utils/serveApp.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

                Function createContent has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                function createContent(params, boundary) {
                  var content = new Stream;
                
                  // Use a promise chain to write all fields to the content
                  // stream in the same order they appear in params.
                Severity: Minor
                Found in modules/multipart/createContent.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

                Function ajaxHandleResponses has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function ajaxHandleResponses( s, jqXHR, responses ) {
                
                    var ct, type, finalDataType, firstDataType,
                        contents = s.contents,
                        dataTypes = s.dataTypes,
                Severity: Minor
                Found in modules/middleware/__tests__/fixtures/jquery-1.8.3.js - About 1 hr to fix

                  Function session has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function session(app, options) {
                    options = options || {};
                  
                    if (typeof options === 'string')
                      options = { secret: options };
                  Severity: Minor
                  Found in modules/middleware/session.js - About 1 hr to fix

                    Function exports has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    module.exports = function (mach) {
                      mach.Message.PARSERS['multipart/form-data'] = function (message, maxLength) {
                        function partHandler(part) {
                          return message.handlePart(part);
                        }
                    Severity: Minor
                    Found in modules/extensions/multipart.js - About 1 hr to fix

                      Function matcherFromTokens has 42 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 modules/middleware/__tests__/fixtures/jquery-1.8.3.js - About 1 hr to fix

                        Function createStack has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function createStack(app) {
                          var layers = [], mappings = [], routes = [];
                          var compiledApp;
                        
                          function compile(app) {
                        Severity: Minor
                        Found in modules/middleware/stack.js - About 1 hr to fix

                          Consider simplifying this complex logical expression.
                          Open

                                      if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
                                          ( jQuery.support.htmlSerialize || !rnoshimcache.test( value )  ) &&
                                          ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
                                          !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {
                          
                          
                          Severity: Critical
                          Found in modules/middleware/__tests__/fixtures/jquery-1.8.3.js - About 1 hr to fix

                            Function val has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                val: function( value ) {
                                    var hooks, ret, isFunction,
                                        elem = this[0];
                            
                                    if ( !arguments.length ) {
                            Severity: Minor
                            Found in modules/middleware/__tests__/fixtures/jquery-1.8.3.js - About 1 hr to fix

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

                              function Sizzle( selector, context, results, seed ) {
                                  results = results || [];
                                  context = context || document;
                                  var match, elem, xml, m,
                                      nodeType = context.nodeType;
                              Severity: Minor
                              Found in modules/middleware/__tests__/fixtures/jquery-1.8.3.js - About 1 hr to fix

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

                                    stop: function( type, clearQueue, gotoEnd ) {
                                        var stopQueue = function( hooks ) {
                                            var stop = hooks.stop;
                                            delete hooks.stop;
                                            stop( gotoEnd );
                                Severity: Minor
                                Found in modules/middleware/__tests__/fixtures/jquery-1.8.3.js - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language