mangroveorg/datawinners

View on GitHub
datawinners/media/javascript/Knockout-Validation/Tests/Qunit/qunit-1.12.0.js

Summary

Maintainability
F
2 wks
Test Coverage

File qunit-1.12.0.js has 1607 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * QUnit v1.12.0 - A JavaScript Unit Testing Framework
 *
 * http://qunitjs.com
 *

    Function jsDump has 187 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    QUnit.jsDump = (function() {
        function quote( str ) {
            return "\"" + str.toString().replace( /"/g, "\\\"" ) + "\"";
        }
        function literal( o ) {

      Function equiv has 147 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      QUnit.equiv = (function() {
      
          // Call the o related callback with the given arguments.
          function bindCallbacks( o, callbacks, args ) {
              var prop = QUnit.objectType( o );

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

        QUnit.load = function() {
            runLoggingCallbacks( "begin", QUnit, {} );
        
            // Initialize the config, saving the execution queue
            var banner, filter, i, label, len, main, ol, toolbar, userAgent, val,

          Function diff has 113 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          QUnit.diff = (function() {
              /*jshint eqeqeq:false, eqnull:true */
              function diff( o, n ) {
                  var i,
                      ns = {},

            Function callbacks has 110 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    callbacks = (function () {
            
                        // for string, boolean, number and null
                        function useStrictEquality( b, a ) {
                            /*jshint eqeqeq:false */

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

                  finish: function() {
                      config.current = this;
                      if ( config.requireExpects && this.expected === null ) {
                          QUnit.pushFailure( "Expected number of assertions to be defined, but expect() was not called.", this.stack );
                      } else if ( this.expected !== null && this.expected !== this.assertions.length ) {

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

                    function diff( o, n ) {
                        var i,
                            ns = {},
                            os = {};
                
                

                  Function done has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function done() {
                      config.autorun = true;
                  
                      // Log the last module results
                      if ( config.currentModule ) {

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

                        init: function() {
                            extend( config, {
                                stats: { all: 0, bad: 0 },
                                moduleStats: { all: 0, bad: 0 },
                                started: +new Date(),

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

                          setup: function() {
                              if (
                                  // Emit moduleStart when we're switching from one module to another
                                  this.module !== config.previousModule ||
                                      // They could be equal (both undefined) but if the previousModule property doesn't

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

                                        "object": function( b, a ) {
                                            /*jshint forin:false */
                                            var i, j, loop, aCircular, bCircular,
                                                // Default to true
                                                eq = true,

                          Function push has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              push: function( result, actual, expected, message ) {
                                  if ( !config.current ) {
                                      throw new Error( "assertion outside test context, was " + sourceFromStacktrace() );
                                  }
                          
                          

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

                                            "array": function( b, a ) {
                                                var i, j, len, loop, aCircular, bCircular;
                            
                                                // b could be an object literal here
                                                if ( QUnit.objectType( b ) !== "array" ) {

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

                                  start: function( count ) {
                                      // QUnit hasn't been initialized yet.
                                      // Note: RequireJS (et al) may delay onLoad
                                      if ( config.semaphore === undefined ) {
                                          QUnit.begin(function() {

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

                                    "throws": function( block, expected, message ) {
                                        var actual,
                                            expectedOutput = expected,
                                            ok = false;
                                
                                

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

                                  function extractStacktrace( e, offset ) {
                                      offset = offset === undefined ? 3 : offset;
                                  
                                      var stack, include, i;
                                  
                                  

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

                                                typeOf: function( obj ) {
                                                    var type;
                                                    if ( obj === null ) {
                                                        type = "null";
                                                    } else if ( typeof obj === "undefined" ) {

                                      Function pushFailure has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          pushFailure: function( message, source, actual ) {
                                              if ( !config.current ) {
                                                  throw new Error( "pushFailure() assertion outside test context, was " + sourceFromStacktrace(2) );
                                              }
                                      
                                      

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

                                            objectType: function( obj ) {
                                                if ( typeof obj === "undefined" ) {
                                                        return "undefined";
                                                // consider: typeof null === object
                                                }

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

                                              queue: function() {
                                                  var bad,
                                                      test = this;
                                          
                                                  synchronize(function() {

                                            Avoid too many return statements within this function.
                                            Open

                                                        return "object";

                                              Avoid too many return statements within this function.
                                              Open

                                                  return !include;

                                                Avoid too many return statements within this function.
                                                Open

                                                                    return true;

                                                  Avoid too many return statements within this function.
                                                  Open

                                                          return include;

                                                    Avoid too many return statements within this function.
                                                    Open

                                                                return errorString;

                                                      Avoid too many return statements within this function.
                                                      Open

                                                              return undefined;

                                                        Avoid too many return statements within this function.
                                                        Open

                                                                return e.sourceURL + ":" + e.line;

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

                                                                      if ( n[i].text != null && n[ i - 1 ].text == null && n[i].row > 0 && o[ n[i].row - 1 ].text == null &&
                                                                                  n[ i - 1 ] == o[ n[i].row - 1 ]) {
                                                          
                                                                          n[ i - 1 ] = {
                                                                              text: n[ i - 1 ],
                                                          datawinners/media/javascript/Knockout-Validation/Tests/Qunit/qunit-1.12.0.js on lines 2115..2126

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

                                                          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 ( n[i].text != null && n[ i + 1 ].text == null && n[i].row + 1 < o.length && o[ n[i].row + 1 ].text == null &&
                                                                                  n[ i + 1 ] == o[ n[i].row + 1 ] ) {
                                                          
                                                                          n[ i + 1 ] = {
                                                                              text: n[ i + 1 ],
                                                          datawinners/media/javascript/Knockout-Validation/Tests/Qunit/qunit-1.12.0.js on lines 2130..2141

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

                                                          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

                                                                  for ( i = 0; i < o.length; i++ ) {
                                                                      if ( !hasOwn.call( os, o[i] ) ) {
                                                                          os[ o[i] ] = {
                                                                              rows: [],
                                                                              n: null
                                                          datawinners/media/javascript/Knockout-Validation/Tests/Qunit/qunit-1.12.0.js on lines 2079..2087

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

                                                          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

                                                                  for ( i = 0; i < n.length; i++ ) {
                                                                      if ( !hasOwn.call( ns, n[i] ) ) {
                                                                          ns[ n[i] ] = {
                                                                              rows: [],
                                                                              o: null
                                                          datawinners/media/javascript/Knockout-Validation/Tests/Qunit/qunit-1.12.0.js on lines 2089..2097

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

                                                          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

                                                                  try {
                                                                      this.testEnvironment.setup.call( this.testEnvironment, QUnit.assert );
                                                                  } catch( e ) {
                                                                      QUnit.pushFailure( "Setup failed on " + this.testName + ": " + ( e.message || e ), extractStacktrace( e, 1 ) );
                                                                  }
                                                          datawinners/media/javascript/Knockout-Validation/Tests/Qunit/qunit-1.12.0.js on lines 227..231

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

                                                          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

                                                                      try {
                                                                          this.testEnvironment.teardown.call( this.testEnvironment, QUnit.assert );
                                                                      } catch( e ) {
                                                                          QUnit.pushFailure( "Teardown failed on " + this.testName + ": " + ( e.message || e ), extractStacktrace( e, 1 ) );
                                                                      }
                                                          datawinners/media/javascript/Knockout-Validation/Tests/Qunit/qunit-1.12.0.js on lines 175..179

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

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

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

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

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

                                                          Refactorings

                                                          Further Reading

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

                                                          function inArray( elem, array ) {
                                                              if ( array.indexOf ) {
                                                                  return array.indexOf( elem );
                                                              }
                                                          
                                                          
                                                          datawinners/media/admin/js/jquery.js on lines 609..621

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

                                                          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 ( config.currentModule ) {
                                                                  runLoggingCallbacks( "moduleDone", QUnit, {
                                                                      name: config.currentModule,
                                                                      failed: config.moduleStats.bad,
                                                                      passed: config.moduleStats.all - config.moduleStats.bad,
                                                          datawinners/media/javascript/Knockout-Validation/Tests/Qunit/qunit-1.12.0.js on lines 128..135

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

                                                          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 ( hasOwn.call( config, "previousModule" ) ) {
                                                                          runLoggingCallbacks( "moduleDone", QUnit, {
                                                                              name: config.previousModule,
                                                                              failed: config.moduleStats.bad,
                                                                              passed: config.moduleStats.all - config.moduleStats.bad,
                                                          datawinners/media/javascript/Knockout-Validation/Tests/Qunit/qunit-1.12.0.js on lines 1254..1261

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

                                                          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

                                                                              o[ os[i].rows[0] ] = {
                                                                                  text: o[ os[i].rows[0] ],
                                                                                  row: ns[i].rows[0]
                                                                              };
                                                          datawinners/media/javascript/Knockout-Validation/Tests/Qunit/qunit-1.12.0.js on lines 2102..2105

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

                                                          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

                                                                              n[ ns[i].rows[0] ] = {
                                                                                  text: n[ ns[i].rows[0] ],
                                                                                  row: os[i].rows[0]
                                                                              };
                                                          datawinners/media/javascript/Knockout-Validation/Tests/Qunit/qunit-1.12.0.js on lines 2106..2109

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

                                                          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