CaffGeek/MBACNationals

View on GitHub
Web.Admin/2014/wordpress/wp-includes/js/scriptaculous/unittest.js

Summary

Maintainability
F
5 days
Test Coverage

File unittest.js has 524 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// script.aculo.us unittest.js v1.8.0, Tue Nov 06 15:01:40 +0300 2007

// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
//           (c) 2005-2007 Jon Tirsen (http://www.tirsen.com)
//           (c) 2005-2007 Michael Schuerig (http://www.schuerig.de/michael/)
Severity: Major
Found in Web.Admin/2014/wordpress/wp-includes/js/scriptaculous/unittest.js - About 1 day to fix

    prototype has 33 functions (exceeds 20 allowed). Consider refactoring.
    Open

    Test.Unit.Assertions.prototype = {
      initialize: function() {
        this.assertions = 0;
        this.failures   = 0;
        this.errors     = 0;
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-includes/js/scriptaculous/unittest.js - About 4 hrs to fix

      Function initialize has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

        initialize: function(testcases) {
          this.options = Object.extend({
            testLog: 'testlog'
          }, arguments[1] || {});
          this.options.resultsURL = this.parseResultsURLQueryParameter();
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-includes/js/scriptaculous/unittest.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 initialize has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        initialize: function(testcases) {
          this.options = Object.extend({
            testLog: 'testlog'
          }, arguments[1] || {});
          this.options.resultsURL = this.parseResultsURLQueryParameter();
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-includes/js/scriptaculous/unittest.js - About 1 hr to fix

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

        Test.setupBDDExtensionMethods = function(){
          var METHODMAP = {
            shouldEqual:     'assertEqual',
            shouldNotEqual:  'assertNotEqual',
            shouldEqualEnum: 'assertEnumEqual',
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-includes/js/scriptaculous/unittest.js - About 1 hr to fix

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

          Event.simulateMouse = function(element, eventName) {
            var options = Object.extend({
              pointerX: 0,
              pointerY: 0,
              buttons:  0,
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-includes/js/scriptaculous/unittest.js - About 1 hr to fix

            Function getResult has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              getResult: function() {
                var hasFailure = false;
                for(var i=0;i<this.tests.length;i++) {
                  if (this.tests[i].errors > 0) {
                    return "ERROR";
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-includes/js/scriptaculous/unittest.js - About 35 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

            Function context has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            Test.context = function(name, spec, log){
              Test.setupBDDExtensionMethods();
              
              var compiledSpec = {};
              var titles = {};
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-includes/js/scriptaculous/unittest.js - About 25 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

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

              assertEqual: function(expected, actual) {
                var message = arguments[2] || "assertEqual";
                try { (expected == actual) ? this.pass() :
                  this.fail(message + ': expected "' + Test.Unit.inspect(expected) + 
                    '", actual "' + Test.Unit.inspect(actual) + '"'); }
            Web.Admin/2014/wordpress/wp-includes/js/scriptaculous/unittest.js on lines 319..325

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

            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

              assertIdentical: function(expected, actual) { 
                var message = arguments[2] || "assertIdentical"; 
                try { (expected === actual) ? this.pass() : 
                  this.fail(message + ': expected "' + Test.Unit.inspect(expected) +  
                    '", actual "' + Test.Unit.inspect(actual) + '"'); } 
            Web.Admin/2014/wordpress/wp-includes/js/scriptaculous/unittest.js on lines 291..297

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

            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

              assertType: function(expected, actual) {
                var message = arguments[2] || 'assertType';
                try { 
                  (actual.constructor == expected) ? this.pass() : 
                  this.fail(message + ': expected "' + Test.Unit.inspect(expected) +  
            Web.Admin/2014/wordpress/wp-includes/js/scriptaculous/unittest.js on lines 362..369

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

            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

              assertNotOfType: function(expected, actual) {
                var message = arguments[2] || 'assertNotOfType';
                try { 
                  (actual.constructor != expected) ? this.pass() : 
                  this.fail(message + ': expected "' + Test.Unit.inspect(expected) +  
            Web.Admin/2014/wordpress/wp-includes/js/scriptaculous/unittest.js on lines 354..361

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

            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

              benchmark: function(operation, iterations) {
                var startAt = new Date();
                (iterations || 1).times(operation);
                var timeTaken = ((new Date())-startAt);
                this.info((arguments[2] || 'Operation') + ' finished ' + 
            Web.Admin/2014/wordpress/wp-includes/js/scriptaculous/unittest.js on lines 456..463

            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

              benchmark: function(operation, iterations) {
                var startAt = new Date();
                (iterations || 1).times(operation);
                var timeTaken = ((new Date())-startAt);
                this.info((arguments[2] || 'Operation') + ' finished ' + 
            Web.Admin/2014/wordpress/wp-includes/js/scriptaculous/unittest.js on lines 433..440

            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 3 locations. Consider refactoring.
            Open

              var METHODMAP = {
                shouldEqual:     'assertEqual',
                shouldNotEqual:  'assertNotEqual',
                shouldEqualEnum: 'assertEnumEqual',
                shouldBeA:       'assertType',
            Web.Admin/2014/wordpress/wp-includes/js/codepress/codepress.js on lines 103..116
            Web.Admin/2014/wordpress/wp-includes/js/tinymce/langs/wp-langs-en.js on lines 382..395

            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

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

                  if(!m) m = obj['is'+method.charAt(0).toUpperCase()+method.slice(1)];
            Web.Admin/2014/wordpress/wp-includes/js/scriptaculous/unittest.js on lines 395..395

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

            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

                  if(!m) m = obj['is'+method.charAt(0).toUpperCase()+method.slice(1)];
            Web.Admin/2014/wordpress/wp-includes/js/scriptaculous/unittest.js on lines 404..404

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

            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

              message: function(message) {
                if (!this.log) return;
                this.messageCell.innerHTML = this._toHTML(message);
              },
            Web.Admin/2014/wordpress/wp-includes/js/scriptaculous/unittest.js on lines 109..112

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

            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

              summary: function(summary) {
                if (!this.log) return;
                this.logsummary.innerHTML = this._toHTML(summary);
              },
            Web.Admin/2014/wordpress/wp-includes/js/scriptaculous/unittest.js on lines 105..108

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

            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