mangroveorg/datawinners

View on GitHub
datawinners/media/javascript/Knockout-Validation/Lib/knockout-latest.debug.js

Summary

Maintainability
F
3 wks
Test Coverage

File knockout-latest.debug.js has 3123 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Knockout JavaScript library v3.0.0
// (c) Steven Sanderson - http://knockoutjs.com/
// License: MIT (http://www.opensource.org/licenses/mit-license.php)

(function(){

    Function utils has 417 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    ko.utils = (function () {
        var objectForEach = function(obj, action) {
            for (var prop in obj) {
                if (obj.hasOwnProperty(prop)) {
                    action(prop, obj[prop]);

      Function dependentObservable has 135 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      ko.dependentObservable = function (evaluatorFunctionOrOptions, evaluatorFunctionTarget, options) {
          var _latestValue,
              _hasBeenEvaluated = false,
              _isBeingEvaluated = false,
              _suppressDisposalUntilDisposeWhenReturnsFalse = false,

        Function expressionRewriting has 109 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        ko.expressionRewriting = (function () {
            var javaScriptReservedWords = ["true", "false", "null", "undefined"];
        
            // Matches something that can be assigned to--either an isolated identifier or something ending with a property accessor
            // This is designed to be simple and avoid false negatives, but could produce false positives (e.g., a+b.c).

          Function applyBindingsToNodeInternal has 87 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function applyBindingsToNodeInternal(node, sourceBindings, bindingContext, bindingContextMayDifferFromDomParentElement) {
                  // Prevent multiple applyBindings calls for the same node, except when a binding value is specified
                  var alreadyBound = ko.utils.domData.get(node, boundElementDomDataKey);
                  if (!sourceBindings) {
                      if (alreadyBound) {

            Function update has 86 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                'update': function (element, valueAccessor, allBindings) {
                    function selectedOptions() {
                        return ko.utils.arrayFilter(element.options, function (node) { return node.selected; });
                    }
            
            

              Function setDomNodeChildrenFromArrayMapping has 85 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  ko.utils.setDomNodeChildrenFromArrayMapping = function (domNode, array, mapping, options, callbackAfterAddingNodes) {
                      // Compare the provided array against the previous one
                      array = array || [];
                      options = options || {};
                      var isFirstExecution = ko.utils.domData.get(domNode, lastMappingResultDomDataKey) === undefined;

                Function compareArrays has 81 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                ko.utils.compareArrays = (function () {
                    var statusNotInOld = 'added', statusNotInNew = 'deleted';
                
                    // Simple calculation based on Levenshtein distance.
                    function compareArrays(oldArray, newArray, options) {

                  Function compareSmallArrayToBigArray has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function compareSmallArrayToBigArray(smlArray, bigArray, statusNotInSml, statusNotInBig, options) {
                          var myMin = Math.min,
                              myMax = Math.max,
                              editDistanceMatrix = [],
                              smlIndex, smlIndexMax = smlArray.length,

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

                    ko.utils.domNodeDisposal = new (function () {
                        var domDataKey = ko.utils.domData.nextKey();
                        var cleanableNodeTypes = { 1: true, 8: true, 9: true };       // Element, Comment, Document
                        var cleanableNodeTypesWithDescendants = { 1: true, 9: true }; // Element, Document
                    
                    

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

                      ko.memoization = (function () {
                          var memos = {};
                      
                          function randomMax8HexChars() {
                              return (((1 + Math.random()) * 0x100000000) | 0).toString(16).substring(1);

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

                            'init': function (element, valueAccessor, allBindings) {
                                function checkedValue() {
                                    return allBindings['has']('checkedValue')
                                        ? ko.utils.unwrapObservable(allBindings.get('checkedValue'))
                                        : element.value;

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

                              ko.jqueryTmplTemplateEngine = function () {
                                  // Detect which version of jquery-tmpl you're using. Unfortunately jquery-tmpl
                                  // doesn't expose a version number, so we have to infer it.
                                  // Note that as of Knockout 1.3, we only support jQuery.tmpl 1.0.0pre and later,
                                  // which KO internally refers to as version "2", so older versions are no longer detected.

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

                            ko.templateRewriting = (function () {
                                var memoizeDataBindingAttributeSyntaxRegex = /(<([a-z]+\d*)(?:\s+(?!data-bind\s*=\s*)[a-z0-9\-]+(?:=(?:\"[^\"]*\"|\'[^\']*\'))?)*\s+)data-bind\s*=\s*(["'])([\s\S]*?)\3/gi;
                                var memoizeVirtualContainerBindingSyntaxRegex = /<!--\s*ko\b\s*([\s\S]*?)\s*-->/g;
                            
                                function validateDataBindValuesForRewriting(keyValueArray) {

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

                                  ko.bindingContext = function(dataItemOrAccessor, parentContext, dataItemAlias, extendCallback) {
                              
                                      // The binding context object includes static properties for the current, parent, and root view models.
                                      // If a view model is actually stored in an observable, the corresponding binding context object, and
                                      // any child contexts, must be updated when the view model is changed.

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

                                    target.cacheDiffForKnownOperation = function(rawArray, operationName, args) {
                                        // Only run if we're currently tracking changes for this observable array
                                        // and there aren't any pending deferred notifications.
                                        if (!trackingChanges || pendingNotifications) {
                                            return;

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

                                      function evaluateImmediate() {
                                          if (_isBeingEvaluated) {
                                              // If the evaluation of a ko.computed causes side effects, it's possible that it will trigger its own re-evaluation.
                                              // This is not desirable (it's hard for a developer to realise a chain of dependencies might cause this, and they almost
                                              // certainly didn't intend infinite re-evaluations). So, for predictability, we simply prevent ko.computeds from causing

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

                                    ko.utils.domData = new (function () {
                                        var uniqueId = 0;
                                        var dataStoreKeyExpandoPropertyName = "__ko__" + (new Date).getTime();
                                        var dataStore = {};
                                    
                                    

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

                                          function parseObjectLiteral(objectLiteralString) {
                                              // Trim leading and trailing spaces from the string
                                              var str = ko.utils.stringTrim(objectLiteralString);
                                      
                                              // Trim braces '{' surrounding the whole object literal

                                        Function activateBindingsOnContinuousNodeArray has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                            function activateBindingsOnContinuousNodeArray(continuousNodeArray, bindingContext) {
                                                // To be used on any nodes that have been rendered by a template and have been inserted into some parent element
                                                // Walks through continuousNodeArray (which *must* be continuous, i.e., an uninterrupted sequence of sibling nodes, because
                                                // the algorithm for walking them relies on this), and for each top-level item in the virtual-element sense,
                                                // (1) Does a regular "applyBindings" to associate bindingContext with this node and to activate any non-memoized bindings

                                          Function writeValue has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                          Open

                                                  writeValue: function(element, value) {
                                                      switch (ko.utils.tagNameLower(element)) {
                                                          case 'option':
                                                              switch(typeof value) {
                                                                  case "string":

                                            Function postJson has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                            Open

                                                    postJson: function (urlOrForm, data, options) {
                                                        options = options || {};
                                                        var params = options['params'] || {};
                                                        var includeFields = options['includeFields'] || this.fieldsIncludedWithJsonPost;
                                                        var url = urlOrForm;

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

                                                  'init': function (element, valueAccessor, allBindings) {
                                                      // Always catch "change" event; possibly other events too if asked
                                                      var eventsToCatch = ["change"];
                                                      var requestedEventsToCatch = allBindings.get("valueUpdate");
                                                      var propertyChangedFired = false;

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

                                                    'init' : function (element, valueAccessor, allBindings, viewModel, bindingContext) {
                                                        var eventsToHandle = valueAccessor() || {};
                                                        ko.utils.objectForEach(eventsToHandle, function(eventName) {
                                                            if (typeof eventName == "string") {
                                                                ko.utils.registerEventHandler(element, eventName, function (event) {

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

                                                  ko.dependencyDetection = (function () {
                                                      var _frames = [];
                                                  
                                                      return {
                                                          begin: function (callback) {

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

                                                        ko.renderTemplate = function (template, dataOrBindingContext, options, targetNodeOrNodeArray, renderMode) {
                                                            options = options || {};
                                                            if ((options['templateEngine'] || _templateEngine) == undefined)
                                                                throw new Error("Set a template engine before calling renderTemplate");
                                                            renderMode = renderMode || "replaceChildren";

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

                                                      function makeWithIfBinding(bindingKey, isWith, isNot, makeContextCallback) {
                                                          ko.bindingHandlers[bindingKey] = {
                                                              'init': function(element) {
                                                                  ko.utils.domData.set(element, withIfDomDataKey, {});
                                                                  return { 'controlsDescendantBindings': true };

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

                                                            function executeTemplate(targetNodeOrNodeArray, renderMode, template, bindingContext, options) {
                                                                options = options || {};
                                                                var firstTargetNode = targetNodeOrNodeArray && getFirstNodeFromPossibleArray(targetNodeOrNodeArray);
                                                                var templateDocument = firstTargetNode && firstTargetNode.ownerDocument;
                                                                var templateEngineToUse = (options['templateEngine'] || _templateEngine);

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

                                                              function preProcessBindings(bindingsStringOrKeyValueArray, bindingOptions) {
                                                                  bindingOptions = bindingOptions || {};
                                                          
                                                                  function processKeyValue(key, val) {
                                                                      var writableVal;

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

                                                                function mapJsObjectGraph(rootObject, mapInputCallback, visitedObjects) {
                                                                    visitedObjects = visitedObjects || new objectLookup();
                                                            
                                                                    rootObject = mapInputCallback(rootObject);
                                                                    var canHaveProperties = (typeof rootObject == "object") && (rootObject !== null) && (rootObject !== undefined) && (!(rootObject instanceof Date)) && (!(rootObject instanceof String)) && (!(rootObject instanceof Number)) && (!(rootObject instanceof Boolean));

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

                                                              ko.observable = function (initialValue) {
                                                                  var _latestValue = initialValue;
                                                              
                                                                  function observable() {
                                                                      if (arguments.length > 0) {

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

                                                                        'update': function (element, valueAccessor, allBindings, viewModel, bindingContext) {
                                                                            var templateName = ko.utils.unwrapObservable(valueAccessor()),
                                                                                options = {},
                                                                                shouldDisplay = true,
                                                                                dataValue,

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

                                                                      function topologicalSortBindings(bindings) {
                                                                          // Depth-first sort
                                                                          var result = [],                // The list of key/handler pairs that we will return
                                                                              bindingsConsidered = {},    // A temporary record of which bindings are already in 'result'
                                                                              cyclicDependencyStack = []; // Keeps track of a depth-search so that, if there's a cycle, we know which bindings caused it

                                                                    Avoid deeply nested control flow statements.
                                                                    Open

                                                                                            if (key)
                                                                                                result.push(values ? {key: key, value: values.join('')} : {'unknown': key});

                                                                      Avoid deeply nested control flow statements.
                                                                      Open

                                                                                          if (!values)
                                                                                              continue;

                                                                        Avoid deeply nested control flow statements.
                                                                        Open

                                                                                                    for (var i = 0; i < unbalancedTags.length; i++) {
                                                                                                        if (nodeToInsertBefore)
                                                                                                            elementVerified.insertBefore(unbalancedTags[i], nodeToInsertBefore);
                                                                                                        else
                                                                                                            elementVerified.appendChild(unbalancedTags[i]);

                                                                          Avoid deeply nested control flow statements.
                                                                          Open

                                                                                                          if (ko.utils.arrayIndexOf(cyclicDependencyStack, bindingDependencyKey) !== -1) {
                                                                                                              throw Error("Cannot combine the following bindings, because they have a cyclic dependency: " + cyclicDependencyStack.join(", "));
                                                                                                          } else {
                                                                                                              pushBinding(bindingDependencyKey);
                                                                                                          }

                                                                            Avoid deeply nested control flow statements.
                                                                            Open

                                                                                            } else if (c === 47 && i && tok.length > 1) {  // "/"
                                                                                                // Look at the end of the previous token to determine if the slash is actually division
                                                                                                var match = toks[i-1].match(divisionLookBehind);
                                                                                                if (match && !keywordRegexLookBehind[match[0]]) {
                                                                                                    // The slash is actually a division punctuator; re-parse the remainder of the string (not including the slash)

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

                                                                                  ko.utils.setDomNodeChildrenFromArrayMapping = function (domNode, array, mapping, options, callbackAfterAddingNodes) {

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

                                                                                        'init': function(element, valueAccessor, allBindings, viewModel, bindingContext) {

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

                                                                                      ko.renderTemplate = function (template, dataOrBindingContext, options, targetNodeOrNodeArray, renderMode) {

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

                                                                                        function mapNodeAndRefreshWhenChanged(containerNode, mapping, valueToMap, callbackAfterAddingNodes, index) {

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

                                                                                          ko.renderTemplateForEach = function (template, arrayOrObservableArray, options, targetNode, parentBindingContext) {

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

                                                                                            function compareSmallArrayToBigArray(smlArray, bigArray, statusNotInSml, statusNotInBig, options) {

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

                                                                                              'init': function(element, valueAccessor, allBindings, viewModel, bindingContext) {

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

                                                                                                    'update': function(element, valueAccessor, allBindings, viewModel, bindingContext) {

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

                                                                                                  'init' : function (element, valueAccessor, allBindings, viewModel, bindingContext) {

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

                                                                                                    'update': function(element, valueAccessor, allBindings, viewModel, bindingContext) {

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

                                                                                                      'init': function (element, valueAccessor, allBindings, viewModel, bindingContext) {

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

                                                                                                            'update': function (element, valueAccessor, allBindings, viewModel, bindingContext) {

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

                                                                                                          function executeTemplate(targetNodeOrNodeArray, renderMode, template, bindingContext, options) {

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

                                                                                                                writeValueToProperty: function(property, allBindings, key, value, checkIfDifferent) {

                                                                                                          Avoid too many return statements within this function.
                                                                                                          Open

                                                                                                                      return !!node;

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

                                                                                                                'update': function(element, valueAccessor, allBindings, viewModel, bindingContext) {
                                                                                                                    return ko.bindingHandlers['template']['update'](element, ko.bindingHandlers['foreach'].makeTemplateValueAccessor(valueAccessor), allBindings, viewModel, bindingContext);
                                                                                                                }
                                                                                                            datawinners/media/javascript/ko-binding-extensions.js on lines 33..35

                                                                                                            Duplicated Code

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

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

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

                                                                                                            Tuning

                                                                                                            This issue has a mass of 54.

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

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

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

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

                                                                                                            Refactorings

                                                                                                            Further Reading

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

                                                                                                                        } else if (smlIndex && meMinusOne === editDistanceMatrix[smlIndex - 1][bigIndex]) {
                                                                                                                            notInBig.push(editScript[editScript.length] = {     // deleted
                                                                                                                                'status': statusNotInBig,
                                                                                                                                'value': smlArray[--smlIndex],
                                                                                                                                'index': smlIndex });
                                                                                                            datawinners/media/javascript/Knockout-Validation/Lib/knockout-latest.debug.js on lines 3910..3928

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

                                                                                                            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

                                                                                                                'init': function(element, valueAccessor, allBindings, viewModel, bindingContext) {
                                                                                                                    return ko.bindingHandlers['template']['init'](element, ko.bindingHandlers['foreach'].makeTemplateValueAccessor(valueAccessor));
                                                                                                                },
                                                                                                            datawinners/media/javascript/ko-binding-extensions.js on lines 30..32

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

                                                                                                            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 (bigIndex && meMinusOne === editDistanceMatrix[smlIndex][bigIndex-1]) {
                                                                                                                            notInSml.push(editScript[editScript.length] = {     // added
                                                                                                                                'status': statusNotInSml,
                                                                                                                                'value': bigArray[--bigIndex],
                                                                                                                                'index': bigIndex });
                                                                                                            datawinners/media/javascript/Knockout-Validation/Lib/knockout-latest.debug.js on lines 3915..3928

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

                                                                                                            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

                                                                                                                        try { handlerReturnValue = value.call(bindingContext['$data'], element); }
                                                                                                                        finally {
                                                                                                                            if (handlerReturnValue !== true) { // Normally we want to prevent default action. Developer can override this be explicitly returning true.
                                                                                                                                if (event.preventDefault)
                                                                                                                                    event.preventDefault();
                                                                                                            datawinners/media/javascript/Knockout-Validation/Lib/knockout-latest.debug.js on lines 2886..2899

                                                                                                            Duplicated Code

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

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

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

                                                                                                            Tuning

                                                                                                            This issue has a mass of 47.

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

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

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

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

                                                                                                            Refactorings

                                                                                                            Further Reading

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

                                                                                                                                try {
                                                                                                                                    // Take all the event args, and prefix with the viewmodel
                                                                                                                                    var argsForHandler = ko.utils.makeArray(arguments);
                                                                                                                                    viewModel = bindingContext['$data'];
                                                                                                                                    argsForHandler.unshift(viewModel);
                                                                                                            datawinners/media/javascript/Knockout-Validation/Lib/knockout-latest.debug.js on lines 3238..3246

                                                                                                            Duplicated Code

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

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

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

                                                                                                            Tuning

                                                                                                            This issue has a mass of 47.

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

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

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

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

                                                                                                            Refactorings

                                                                                                            Further Reading

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

                                                                                                                            for (var i = 0, j = nodesToReplaceArray.length; i < j; i++) {
                                                                                                                                ko.removeNode(nodesToReplaceArray[i]);
                                                                                                                            }
                                                                                                            datawinners/media/admin/js/jquery.js on lines 3350..3352
                                                                                                            datawinners/media/javascript/Knockout-Validation/Lib/knockout-latest.debug.js on lines 495..497

                                                                                                            Duplicated Code

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

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

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

                                                                                                            Tuning

                                                                                                            This issue has a mass of 47.

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

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

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

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

                                                                                                            Refactorings

                                                                                                            Further Reading

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

                                                                                                                        for (var i = 0, j = arrayLikeObject.length; i < j; i++) {
                                                                                                                            result.push(arrayLikeObject[i]);
                                                                                                                        };
                                                                                                            datawinners/media/admin/js/jquery.js on lines 3350..3352
                                                                                                            datawinners/media/javascript/Knockout-Validation/Lib/knockout-latest.debug.js on lines 239..241

                                                                                                            Duplicated Code

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

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

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

                                                                                                            Tuning

                                                                                                            This issue has a mass of 47.

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

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

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

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

                                                                                                            Refactorings

                                                                                                            Further Reading

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

                                                                                                                    var predicate = typeof valueOrPredicate == "function" && !ko.isObservable(valueOrPredicate) ? valueOrPredicate : function (value) { return value === valueOrPredicate; };
                                                                                                            datawinners/media/javascript/Knockout-Validation/Lib/knockout-latest.debug.js on lines 1206..1206

                                                                                                            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

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

                                                                                                                    var predicate = typeof valueOrPredicate == "function" && !ko.isObservable(valueOrPredicate) ? valueOrPredicate : function (value) { return value === valueOrPredicate; };
                                                                                                            datawinners/media/javascript/Knockout-Validation/Lib/knockout-latest.debug.js on lines 1168..1168

                                                                                                            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

                                                                                                                    if (arguments.length == 0) {
                                                                                                                        var templateData = ko.utils.domData.get(this.domElement, anonymousTemplatesDomDataKey) || {};
                                                                                                                        if (templateData.textData === undefined && templateData.containerData)
                                                                                                                            templateData.textData = templateData.containerData.innerHTML;
                                                                                                                        return templateData.textData;
                                                                                                            datawinners/media/javascript/Knockout-Validation/Lib/knockout-latest.debug.js on lines 3573..3579

                                                                                                            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

                                                                                                                function isEndComment(node) {
                                                                                                                    return (node.nodeType == 8) && endCommentRegex.test(commentNodesHaveTextProperty ? node.text : node.nodeValue);
                                                                                                                }
                                                                                                            datawinners/media/javascript/Knockout-Validation/Lib/knockout-latest.debug.js on lines 1983..1985

                                                                                                            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

                                                                                                                    if (arguments.length == 0) {
                                                                                                                        var templateData = ko.utils.domData.get(this.domElement, anonymousTemplatesDomDataKey) || {};
                                                                                                                        return templateData.containerData;
                                                                                                                    } else {
                                                                                                                        var valueToWrite = arguments[0];
                                                                                                            datawinners/media/javascript/Knockout-Validation/Lib/knockout-latest.debug.js on lines 3562..3570

                                                                                                            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

                                                                                                                function isStartComment(node) {
                                                                                                                    return (node.nodeType == 8) && startCommentRegex.test(commentNodesHaveTextProperty ? node.text : node.nodeValue);
                                                                                                                }
                                                                                                            datawinners/media/javascript/Knockout-Validation/Lib/knockout-latest.debug.js on lines 1987..1989

                                                                                                            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