MiniProfiler/rack-mini-profiler

View on GitHub
lib/html/vendor.js

Summary

Maintainability
F
2 mos
Test Coverage

File vendor.js has 714 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
  THIS FILE IS AUTOMATICALLY GENERATED BY THE `write_vendor_js` RAKE TASK.
  DON'T EDIT THIS FILE BY HAND; CHANGES WILL BE OVERRIDEN.
**/

Severity: Major
Found in lib/html/vendor.js - About 1 day to fix

    Function anonymous has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
    Open

    MiniProfiler.templates["profilerTemplate"] = function anonymous(it
    ) {
    var out=' <div class="profiler-result"> <div class="profiler-button ';if(it.has_duplicate_sql_timings){out+='profiler-warning';}out+='"> ';if(it.has_duplicate_sql_timings){out+='<span class="profiler-nuclear">!</span>';}out+=' <span class="profiler-number profiler-duration-milliseconds"> '+( MiniProfiler.formatDuration(it.duration_milliseconds))+' <span class="profiler-unit">ms</span> </span> ';if(MiniProfiler.showTotalSqlCount()){out+=' <span class="profiler-number profiler-sql-count"> '+( it.sql_count)+' <span class="profiler-unit">sql</span> </span> ';}out+=' <span class="profiler-name"> ';if(it.name.length >= 30){out+=' '+( it.name.substring(0,15) + "..." + it.name.slice(-15) )+' ';}else{out+=' '+( it.name)+' ';}out+=' </span> </div> <div class="profiler-popup"> <div class="profiler-info"> <span class="profiler-name"> '+( it.name)+' <span class="profiler-overall-duration">('+( MiniProfiler.formatDuration(it.duration_milliseconds))+' ms)</span> </span> <span class="profiler-server-time">'+( it.machine_name)+' on '+( MiniProfiler.renderDate(it.started_formatted))+'</span> </div> <div class="profiler-output"> <table class="profiler-timings"> <thead> <tr> <th>event</th> <th>duration (ms)</th> <th class="profiler-duration-with-children">with children (ms)</th> <th class="time-from-start">from start (ms)</th> ';if(it.has_sql_timings){out+=' <th colspan="2">query time (ms)</th> ';}out+=' ';var arr1=it.custom_timing_names;if(arr1){var value,i1=-1,l1=arr1.length-1;while(i1<l1){value=arr1[i1+=1];out+=' <th colspan="2">'+( value.toLowerCase() )+' (ms)</th> ';} } out+=' </tr> </thead> <tbody> '+( MiniProfiler.templates.timingTemplate({timing: it.root, page: it}) )+' </tbody> <tfoot> <tr> <td colspan="3"> ';if(!it.client_timings){out+=' '+( MiniProfiler.templates.linksTemplate({timing: it.root, page: it}) )+' ';}out+=' <a class="profiler-toggle-duration-with-children" title="toggles column with aggregate child durations">show time with children</a> <a class="profiler-snapshots-page-link" title="Go to snapshots page" href="'+( MiniProfiler.options.path )+'snapshots">snapshots</a> </td> ';if(it.has_sql_timings){out+=' <td colspan="2" class="profiler-number profiler-percent-in-sql" title="'+( MiniProfiler.getSqlTimingsCount(it.root) )+' queries spent '+( MiniProfiler.formatDuration(it.duration_milliseconds_in_sql) )+' ms of total request time"> '+( MiniProfiler.formatDuration(it.duration_milliseconds_in_sql / it.duration_milliseconds * 100) )+' <span class="profiler-unit">% in sql</span> </td> ';}out+=' ';var arr2=it.custom_timing_names;if(arr2){var value,i2=-1,l2=arr2.length-1;while(i2<l2){value=arr2[i2+=1];out+=' <td colspan="2" class="profiler-number profiler-percentage-in-sql" title="'+( it.custom_timing_stats[value].count )+' '+( value.toLowerCase() )+' invocations spent '+( MiniProfiler.formatDuration(it.custom_timing_stats[value].duration) )+' ms of total request time"> '+( MiniProfiler.formatDuration(it.custom_timing_stats[value].duration / it.duration_milliseconds * 100) )+' <span class="profiler-unit">% in '+( value.toLowerCase() )+'</span> </td> ';} } out+=' </tr> </tfoot> </table> ';if(it.client_timings){out+=' <table class="profiler-timings profiler-client-timings"> <thead> <tr> <th>client event</th> <th>duration (ms)</th> <th>from start (ms)</th> </tr> </thead> <tbody> ';var arr3=MiniProfiler.getClientTimings(it.client_timings);if(arr3){var value,i3=-1,l3=arr3.length-1;while(i3<l3){value=arr3[i3+=1];out+=' <tr class="';if(value.isTrivial){out+='profiler-trivial';}out+='"> <td class="profiler-label">'+( value.name )+'</td> <td class="profiler-duration"> ';if(value.duration >= 0){out+=' <span class="profiler-unit"></span>'+( MiniProfiler.formatDuration(value.duration) )+' ';}out+=' </td> <td class="profiler-duration time-from-start"> <span class="profiler-unit">+</span>'+( MiniProfiler.formatDuration(value.start) )+' </td> </tr> ';} } out+=' </tbody> <tfoot> <td colspan="3"> '+( MiniProfiler.templates.linksTemplate({timing: it.root, page: it}) )+' </td> </tfoot> </table> ';}out+=' ';if(it.custom_fields && Object.keys(it.custom_fields).length > 0){out+=' <p class="custom-fields-title">Snapshot custom fields</p> <table class="profiler-timings"> <tbody> ';var arr4=Object.keys(it.custom_fields);if(arr4){var key,i4=-1,l4=arr4.length-1;while(i4<l4){key=arr4[i4+=1];out+=' <tr> <td class="profiler-label">'+( key )+'</td> <td class="profiler-label">'+( it.custom_fields[key] )+'</td> </tr> ';} } out+=' </tbody> </table> ';}out+=' </div> </div> ';if(it.has_sql_timings){out+=' <div class="profiler-queries"> <table> <thead> <tr> <th class="ta-right">step<br />time from start<br />query type<br />duration</th> <th class="ta-left">call stack<br />query</th> </tr> </thead> <tbody> ';var arr5=MiniProfiler.getSqlTimings(it.root);if(arr5){var value,index=-1,l5=arr5.length-1;while(index<l5){value=arr5[index+=1];out+=' '+( MiniProfiler.templates.sqlGapTemplate({g: value.prevGap}) )+' '+( MiniProfiler.templates.sqlTimingTemplate({i: index, s: value}) )+' ';if(value.nextGap){out+=' '+( MiniProfiler.templates.sqlGapTemplate({g: value.nextGap}) )+' ';}out+=' ';} } out+=' </tbody> </table> <p class="profiler-trivial-gap-container"> <a class="profiler-toggle-trivial-gaps">show trivial gaps</a> </p> </div> ';}out+=' </div>';return out;
    }
    Severity: Minor
    Found in lib/html/vendor.js - About 6 hrs 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 O has 133 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function O(b) {
          function f(c) {
            if (c.charAt(0) !== "\\") return c.charCodeAt(0);
    
            switch (c.charAt(1)) {
    Severity: Major
    Found in lib/html/vendor.js - About 5 hrs to fix

      Consider simplifying this complex logical expression.
      Open

      if (typeof prettyPrint === "undefined") {
        // prettify.js
        // http://code.google.com/p/google-code-prettify/
        // prettier-ignore
        window.PR_SHOULD_USE_CONTINUATION = true;
      Severity: Critical
      Found in lib/html/vendor.js - About 4 hrs to fix

        Function anonymous has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
        Open

        MiniProfiler.templates["timingTemplate"] = function anonymous(it
        ) {
        var out=' <tr class="';if(it.timing.is_trivial){out+='profiler-trivial';}out+='" data-timing-id="'+( it.timing.id )+'"> <td class="profiler-label" title="';if(it.timing.name && it.timing.name.length > 45){out+=''+( it.timing.name );}out+='"> <span class="profiler-indent">'+( MiniProfiler.renderIndent(it.timing.depth) )+'</span> '+( it.timing.name.slice(0,45) );if(it.timing.name && it.timing.name.length > 45){out+='...';}out+=' </td> <td class="profiler-duration" title="duration of this step without any children\'s durations"> '+( MiniProfiler.formatDuration(it.timing.duration_without_children_milliseconds) )+' </td> <td class="profiler-duration profiler-duration-with-children" title="duration of this step and its children"> '+( MiniProfiler.formatDuration(it.timing.duration_milliseconds) )+' </td> <td class="profiler-duration time-from-start" title="time elapsed since profiling started"> <span class="profiler-unit">+</span>'+( MiniProfiler.formatDuration(it.timing.start_milliseconds) )+' </td> ';if(it.timing.has_sql_timings){out+=' <td class="profiler-duration ';if(it.timing.has_duplicate_sql_timings){out+='profiler-warning';}out+='" title="';if(it.timing.has_duplicate_sql_timings){out+='duplicate queries detected - ';}if(it.timing.executed_readers > 0 || it.timing.executed_scalars > 0 || it.timing.executed_non_queries > 0){out+=''+( it.timing.executed_readers )+' reader, '+( it.timing.executed_scalars )+' scalar, '+( it.timing.executed_non_queries )+' non-query statements executed';}out+='"> <a class="profiler-queries-show"> ';if(it.timing.has_duplicate_sql_timings){out+='<span class="profiler-nuclear">!</span>';}out+=' '+( it.timing.sql_timings.length )+' <span class="profiler-unit">sql</span> </a> </td> <td class="profiler-duration" title="aggregate duration of all queries in this step (excludes children)"> '+( MiniProfiler.formatDuration(it.timing.sql_timings_duration_milliseconds) )+' </td> ';}else{out+=' <td colspan="2"></td> ';}out+=' ';var arr1=it.page.custom_timing_names;if(arr1){var value,i1=-1,l1=arr1.length-1;while(i1<l1){value=arr1[i1+=1];out+=' ';if(it.timing.custom_timings && it.timing.custom_timings[value]){out+=' <td class="profiler-duration" title="aggregate number of all '+( value.toLowerCase() )+' invocations in this step (excludes children)"> '+( it.timing.custom_timings[value].length )+' '+( value.toLowerCase() )+' </td> <td class="profiler-duration" title="aggregate duration of all '+( value.toLowerCase() )+' invocations in this step (excludes children)"> '+( MiniProfiler.formatDuration(it.timing.custom_timing_stats[value].duration) )+' </td> ';}else{out+=' <td colspan="2"></td> ';}out+=' ';} } out+=' </tr> ';if(it.timing.has_children){out+=' ';var arr2=it.timing.children;if(arr2){var value,i2=-1,l2=arr2.length-1;while(i2<l2){value=arr2[i2+=1];out+=' '+( MiniProfiler.templates.timingTemplate({timing: value, page: it.page}) )+' ';} } out+=' ';}return out;
        }
        Severity: Minor
        Found in lib/html/vendor.js - About 4 hrs 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 anonymous has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

        MiniProfiler.templates["snapshotsList"] = function anonymous(it
        ) {
        var out=' '; var data = it.data; out+=' '; var customFieldsNames = it.allCustomFieldsNames; out+=' ';if(data.list && data.list.length){out+=' <h2>Snapshots for '+( data.group_name )+'</h2> <table class="snapshots-table"> <thead> <tr> <th>ID</th> <th>Duration (ms)</th> <th>SQL Count</th> ';var arr1=customFieldsNames;if(arr1){var name,i1=-1,l1=arr1.length-1;while(i1<l1){name=arr1[i1+=1];out+=' <th>'+( name )+'</th> ';} } out+=' <th>Age</th> </tr> </thead> <tbody> ';var arr2=data.list;if(arr2){var row,i2=-1,l2=arr2.length-1;while(i2<l2){row=arr2[i2+=1];out+=' <tr> <td><a href="'+( row.url )+'"> '+( row.id )+' </a></td> <td>'+( MiniProfiler.formatDuration(row.duration) )+'</td> <td>'+( row.sql_count )+'</td> ';var arr3=customFieldsNames;if(arr3){var name,i3=-1,l3=arr3.length-1;while(i3<l3){name=arr3[i3+=1];out+=' <td>'+( row.custom_fields[name] || "" )+'</td> ';} } out+=' <td> ';if(row.timestamp){out+=' '+( MiniProfiler.timestampToRelative(row.timestamp) )+' ';}out+=' </td> </tr> ';} } out+=' </tbody> </table> ';}else{out+=' <h2>No snapshots for '+( data.group_name )+'</h2> ';}return out;
        }
        Severity: Minor
        Found in lib/html/vendor.js - About 3 hrs 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 prettyPrint has 77 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            window.prettyPrint = function (b) {
              function f() {
                for (var t = window.PR_SHOULD_USE_CONTINUATION ? j.now() + 250 : Infinity; q < o.length && j.now() < t; q++) {
                  var p = o[q];
        
        
        Severity: Major
        Found in lib/html/vendor.js - About 3 hrs to fix

          Function U has 71 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function U(b) {
                var f = b.f,
                    i = b.e;
                b.a = f;
          
          
          Severity: Major
          Found in lib/html/vendor.js - About 2 hrs to fix

            Function $ has 67 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function $(b) {
                  function f(D) {
                    if (D > r) {
                      if (j && j !== q) {
                        n.push("</span>");
            Severity: Major
            Found in lib/html/vendor.js - About 2 hrs to fix

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

                  function B(b, f) {
                    var i = {},
                        o;
              
                    (function () {
              Severity: Major
              Found in lib/html/vendor.js - About 2 hrs to fix

                Function f has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      function f() {
                        for (var t = window.PR_SHOULD_USE_CONTINUATION ? j.now() + 250 : Infinity; q < o.length && j.now() < t; q++) {
                          var p = o[q];
                
                          if (p.className && p.className.indexOf("prettyprint") >= 0) {
                Severity: Major
                Found in lib/html/vendor.js - About 2 hrs to fix

                  Function o has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        function o(c) {
                          var d = c.substring(1, c.length - 1).match(RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]", "g"));
                          c = [];
                  
                          for (var a = [], k = d[0] === "^", e = k ? 1 : 0, h = d.length; e < h; ++e) {
                  Severity: Minor
                  Found in lib/html/vendor.js - About 2 hrs to fix

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

                          function n(r) {
                            for (var j = r.c, q = [j, z], m = 0, t = r.source.match(o) || [], p = {}, c = 0, d = t.length; c < d; ++c) {
                              var a = t[c],
                                  k = p[a],
                                  e = void 0,
                    Severity: Minor
                    Found in lib/html/vendor.js - About 1 hr to fix

                      Function H has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          function H(b, f, i) {
                            switch (b.nodeType) {
                              case 1:
                                var o = b.tagName.toLowerCase();
                                f.push("<", o);
                      Severity: Minor
                      Found in lib/html/vendor.js - About 1 hr to fix

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

                              function f(c) {
                                if (c.charAt(0) !== "\\") return c.charCodeAt(0);
                        
                                switch (c.charAt(1)) {
                                  case "b":
                        Severity: Minor
                        Found in lib/html/vendor.js - About 1 hr to fix

                          Function l has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                function l(c) {
                                  for (var d = c.source.match(RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)", "g")), a = d.length, k = [], e = 0, h = 0; e < a; ++e) {
                                    var g = d[e];
                                    if (g === "(") ++h;else if ("\\" === g.charAt(0)) if ((g = +g.substring(1)) && g <= h) k[g] = -1;
                                  }
                          Severity: Minor
                          Found in lib/html/vendor.js - About 1 hr to fix

                            Avoid deeply nested control flow statements.
                            Open

                                          if ((a.tagName === "pre" || a.tagName === "code" || a.tagName === "xmp") && a.className && a.className.indexOf("prettyprint") >= 0) {
                                            d = true;
                                            break;
                                          }
                            Severity: Major
                            Found in lib/html/vendor.js - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                            if (p = m.a) {
                                              c = m.b;
                              
                                              if ("XMP" === c.tagName) {
                                                d = document.createElement("PRE");
                              Severity: Major
                              Found in lib/html/vendor.js - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                              for (h = 0; h < l; ++h) {
                                                g = f[h];
                                
                                                if (e = a.match(g[1])) {
                                                  k = g[0];
                                Severity: Major
                                Found in lib/html/vendor.js - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                if (K) {
                                                  d = a.innerHTML;
                                                  if ("XMP" === a.tagName) d = y(d);else {
                                                    a = a;
                                                    if ("PRE" === a.tagName) a = true;else if (ka.test(d)) {
                                  Severity: Major
                                  Found in lib/html/vendor.js - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                    var out=' '; var data = it.data; out+=' '; var customFieldsNames = it.allCustomFieldsNames; out+=' ';if(data.list && data.list.length){out+=' <h2>Snapshots for '+( data.group_name )+'</h2> <table class="snapshots-table"> <thead> <tr> <th>ID</th> <th>Duration (ms)</th> <th>SQL Count</th> ';var arr1=customFieldsNames;if(arr1){var name,i1=-1,l1=arr1.length-1;while(i1<l1){name=arr1[i1+=1];out+=' <th>'+( name )+'</th> ';} } out+=' <th>Age</th> </tr> </thead> <tbody> ';var arr2=data.list;if(arr2){var row,i2=-1,l2=arr2.length-1;while(i2<l2){row=arr2[i2+=1];out+=' <tr> <td><a href="'+( row.url )+'"> '+( row.id )+' </a></td> <td>'+( MiniProfiler.formatDuration(row.duration) )+'</td> <td>'+( row.sql_count )+'</td> ';var arr3=customFieldsNames;if(arr3){var name,i3=-1,l3=arr3.length-1;while(i3<l3){name=arr3[i3+=1];out+=' <td>'+( row.custom_fields[name] || "" )+'</td> ';} } out+=' <td> ';if(row.timestamp){out+=' '+( MiniProfiler.timestampToRelative(row.timestamp) )+' ';}out+=' </td> </tr> ';} } out+=' </tbody> </table> ';}else{out+=' <h2>No snapshots for '+( data.group_name )+'</h2> ';}return out;
                                    Severity: Major
                                    Found in lib/html/vendor.js - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                } else if ("\\" === g.charAt(0)) if ((g = +g.substring(1)) && g <= h) d[e] = "\\" + k[h];
                                      Severity: Major
                                      Found in lib/html/vendor.js - About 45 mins to fix

                                        Avoid deeply nested control flow statements.
                                        Open

                                                    if (!ba.test(m)) if (ca.test(m)) {
                                                      f.push(m.substring(9, m.length - 3));
                                                      n += m.length - 12;
                                                    } else if (da.test(m)) {
                                                      f.push("\n");
                                        Severity: Major
                                        Found in lib/html/vendor.js - About 45 mins to fix

                                          Function anonymous has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                          Open

                                          MiniProfiler.templates["snapshotsGroupsList"] = function anonymous(it
                                          ) {
                                          var out=' ';if(it.list && it.list.length){out+=' <table class="snapshots-table"> <thead> <tr> <th>Requests Group</th> <th>Worst Time (ms)</th> <th>Best Time (ms)</th> <th>No. of Snapshots</th> </tr> </thead> <tbody> ';var arr1=it.list;if(arr1){var row,i1=-1,l1=arr1.length-1;while(i1<l1){row=arr1[i1+=1];out+=' <tr> <td class="request-group"><a href="'+( row.url )+'">'+( row.name )+'</a></td> <td>'+( MiniProfiler.formatDuration(row.worst_score) )+'</td> <td>'+( MiniProfiler.formatDuration(row.best_score) )+'</td> <td>'+( row.snapshots_count )+'</td> </tr> ';} } out+=' </tbody> </table> ';}else{out+=' <h2>No snapshots exist</h2> ';}return out;
                                          }
                                          Severity: Minor
                                          Found in lib/html/vendor.js - About 45 mins 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

                                          Avoid deeply nested control flow statements.
                                          Open

                                                        if (null === K) {
                                                          d = document.createElement("PRE");
                                                          d.appendChild(document.createTextNode('<!DOCTYPE foo PUBLIC "foo bar">\n<foo />'));
                                                          K = !/</.test(d.innerHTML);
                                                        }
                                          Severity: Major
                                          Found in lib/html/vendor.js - About 45 mins to fix

                                            Avoid deeply nested control flow statements.
                                            Open

                                                        if (k < 0) a = p;else {
                                                          for (--k; (k = p.indexOf("&#", k + 1)) >= 0;) {
                                                            var e = p.indexOf(";", k);
                                            
                                                            if (e >= 0) {
                                            Severity: Major
                                            Found in lib/html/vendor.js - About 45 mins to fix

                                              Avoid deeply nested control flow statements.
                                              Open

                                                            for (var r = [], j = n; --j >= 0;) {
                                                              r[j] = l[j];
                                                            }
                                              Severity: Major
                                              Found in lib/html/vendor.js - About 45 mins to fix

                                                Consider simplifying this complex logical expression.
                                                Open

                                                          if (!(s < 65 || g > 122)) {
                                                            s < 65 || g > 90 || a.push([Math.max(65, g) | 32, Math.min(s, 90) | 32]);
                                                            s < 97 || g > 122 || a.push([Math.max(97, g) & -33, Math.min(s, 122) & -33]);
                                                          }
                                                Severity: Major
                                                Found in lib/html/vendor.js - About 40 mins to fix

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

                                                  if (typeof prettyPrint === "undefined") {
                                                    // prettify.js
                                                    // http://code.google.com/p/google-code-prettify/
                                                    // prettier-ignore
                                                    window.PR_SHOULD_USE_CONTINUATION = true;
                                                  Severity: Major
                                                  Found in lib/html/vendor.js and 1 other location - About 1 mo to fix
                                                  lib/html/pretty-print.js on lines 1..810

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

                                                  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

                                                  var out=' <tr class="';if(it.timing.is_trivial){out+='profiler-trivial';}out+='" data-timing-id="'+( it.timing.id )+'"> <td class="profiler-label" title="';if(it.timing.name && it.timing.name.length > 45){out+=''+( it.timing.name );}out+='"> <span class="profiler-indent">'+( MiniProfiler.renderIndent(it.timing.depth) )+'</span> '+( it.timing.name.slice(0,45) );if(it.timing.name && it.timing.name.length > 45){out+='...';}out+=' </td> <td class="profiler-duration" title="duration of this step without any children\'s durations"> '+( MiniProfiler.formatDuration(it.timing.duration_without_children_milliseconds) )+' </td> <td class="profiler-duration profiler-duration-with-children" title="duration of this step and its children"> '+( MiniProfiler.formatDuration(it.timing.duration_milliseconds) )+' </td> <td class="profiler-duration time-from-start" title="time elapsed since profiling started"> <span class="profiler-unit">+</span>'+( MiniProfiler.formatDuration(it.timing.start_milliseconds) )+' </td> ';if(it.timing.has_sql_timings){out+=' <td class="profiler-duration ';if(it.timing.has_duplicate_sql_timings){out+='profiler-warning';}out+='" title="';if(it.timing.has_duplicate_sql_timings){out+='duplicate queries detected - ';}if(it.timing.executed_readers > 0 || it.timing.executed_scalars > 0 || it.timing.executed_non_queries > 0){out+=''+( it.timing.executed_readers )+' reader, '+( it.timing.executed_scalars )+' scalar, '+( it.timing.executed_non_queries )+' non-query statements executed';}out+='"> <a class="profiler-queries-show"> ';if(it.timing.has_duplicate_sql_timings){out+='<span class="profiler-nuclear">!</span>';}out+=' '+( it.timing.sql_timings.length )+' <span class="profiler-unit">sql</span> </a> </td> <td class="profiler-duration" title="aggregate duration of all queries in this step (excludes children)"> '+( MiniProfiler.formatDuration(it.timing.sql_timings_duration_milliseconds) )+' </td> ';}else{out+=' <td colspan="2"></td> ';}out+=' ';var arr1=it.page.custom_timing_names;if(arr1){var value,i1=-1,l1=arr1.length-1;while(i1<l1){value=arr1[i1+=1];out+=' ';if(it.timing.custom_timings && it.timing.custom_timings[value]){out+=' <td class="profiler-duration" title="aggregate number of all '+( value.toLowerCase() )+' invocations in this step (excludes children)"> '+( it.timing.custom_timings[value].length )+' '+( value.toLowerCase() )+' </td> <td class="profiler-duration" title="aggregate duration of all '+( value.toLowerCase() )+' invocations in this step (excludes children)"> '+( MiniProfiler.formatDuration(it.timing.custom_timing_stats[value].duration) )+' </td> ';}else{out+=' <td colspan="2"></td> ';}out+=' ';} } out+=' </tr> ';if(it.timing.has_children){out+=' ';var arr2=it.timing.children;if(arr2){var value,i2=-1,l2=arr2.length-1;while(i2<l2){value=arr2[i2+=1];out+=' '+( MiniProfiler.templates.timingTemplate({timing: value, page: it.page}) )+' ';} } out+=' ';}return out;
                                                  Severity: Minor
                                                  Found in lib/html/vendor.js and 1 other location - About 40 mins to fix
                                                  lib/html/vendor.js on lines 14..14

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

                                                  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

                                                  var out=' <a href="'+( MiniProfiler.shareUrl(it.page.id) )+'" class="profiler-share-profiler-results" target="_blank">share</a> <a href="'+( MiniProfiler.moreUrl(it.page.name) )+'" class="profiler-more-actions">more</a> ';if(it.page.has_flamegraph){out+=' <a href="'+( MiniProfiler.flamegraphUrl(it.page.id) )+'" class="profiler-show-flamegraph" target="_blank">flamegraph</a> ';}out+=' ';if(it.custom_link){out+=' <a href="'+( it.custom_link )+'" class="profiler-custom-link" target="_blank">'+( it.custom_link_name )+'</a> ';}out+=' ';if(it.page.has_trivial_timings){out+=' <a class="profiler-toggle-trivial" data-show-on-load="'+( it.page.has_all_trivial_timings )+'" title="toggles any rows with &lt; '+( it.page.trivial_duration_threshold_milliseconds )+' ms"> show trivial </a> ';}return out;
                                                  Severity: Minor
                                                  Found in lib/html/vendor.js and 1 other location - About 40 mins to fix
                                                  lib/html/vendor.js on lines 18..18

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

                                                  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

                                                  var out=' ';if(it.list && it.list.length){out+=' <table class="snapshots-table"> <thead> <tr> <th>Requests Group</th> <th>Worst Time (ms)</th> <th>Best Time (ms)</th> <th>No. of Snapshots</th> </tr> </thead> <tbody> ';var arr1=it.list;if(arr1){var row,i1=-1,l1=arr1.length-1;while(i1<l1){row=arr1[i1+=1];out+=' <tr> <td class="request-group"><a href="'+( row.url )+'">'+( row.name )+'</a></td> <td>'+( MiniProfiler.formatDuration(row.worst_score) )+'</td> <td>'+( MiniProfiler.formatDuration(row.best_score) )+'</td> <td>'+( row.snapshots_count )+'</td> </tr> ';} } out+=' </tbody> </table> ';}else{out+=' <h2>No snapshots exist</h2> ';}return out;
                                                  Severity: Minor
                                                  Found in lib/html/vendor.js and 1 other location - About 35 mins to fix
                                                  lib/html/vendor.js on lines 34..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 46.

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

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

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

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

                                                  Refactorings

                                                  Further Reading

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

                                                  var out=' '; var data = it.data; out+=' '; var customFieldsNames = it.allCustomFieldsNames; out+=' ';if(data.list && data.list.length){out+=' <h2>Snapshots for '+( data.group_name )+'</h2> <table class="snapshots-table"> <thead> <tr> <th>ID</th> <th>Duration (ms)</th> <th>SQL Count</th> ';var arr1=customFieldsNames;if(arr1){var name,i1=-1,l1=arr1.length-1;while(i1<l1){name=arr1[i1+=1];out+=' <th>'+( name )+'</th> ';} } out+=' <th>Age</th> </tr> </thead> <tbody> ';var arr2=data.list;if(arr2){var row,i2=-1,l2=arr2.length-1;while(i2<l2){row=arr2[i2+=1];out+=' <tr> <td><a href="'+( row.url )+'"> '+( row.id )+' </a></td> <td>'+( MiniProfiler.formatDuration(row.duration) )+'</td> <td>'+( row.sql_count )+'</td> ';var arr3=customFieldsNames;if(arr3){var name,i3=-1,l3=arr3.length-1;while(i3<l3){name=arr3[i3+=1];out+=' <td>'+( row.custom_fields[name] || "" )+'</td> ';} } out+=' <td> ';if(row.timestamp){out+=' '+( MiniProfiler.timestampToRelative(row.timestamp) )+' ';}out+=' </td> </tr> ';} } out+=' </tbody> </table> ';}else{out+=' <h2>No snapshots for '+( data.group_name )+'</h2> ';}return out;
                                                  Severity: Minor
                                                  Found in lib/html/vendor.js and 1 other location - About 35 mins to fix
                                                  lib/html/vendor.js on lines 30..30

                                                  Duplicated Code

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

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

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

                                                  Tuning

                                                  This issue has a mass of 46.

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

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

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

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

                                                  Refactorings

                                                  Further Reading

                                                  There are no issues that match your filters.

                                                  Category
                                                  Status