codenautas/discrepances

View on GitHub

Showing 17 of 21 total issues

File discrepances.js has 298 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"use strict";

(function codenautasModuleDefinition(root, name, factory) {
    /* global define */
    /* istanbul ignore next */
Severity: Minor
Found in lib/discrepances.js - About 3 hrs to fix

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

    function keying(falto, object, prefix){
        var isContainer=false;
        [{
            name:'array',
            left:"[",
    Severity: Minor
    Found in lib/discrepances.js - About 1 hr to fix

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

      function compareDates(a, b) {
          if(a.getTime()===b.getTime()){
              var co = compareObjects(a,b,{unordered:true});
              if(co){
                  return {date:co.object};
      Severity: Minor
      Found in lib/discrepances.js - About 1 hr to fix

        Function nestedObject has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function nestedObject(a, b, opts){
            opts = changing(defaultOpts, opts||{});
            if(a === b){ return null; }
            /*eslint-disable eqeqeq */
            if(opts.autoTypeCast && a == b){ return null; }
        Severity: Minor
        Found in lib/discrepances.js - About 1 hr to fix

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

          function compareObjects(a, b, opts, hiddenAttrs) {
              var rv = {};
              var isOfClassError = !!hiddenAttrs;
              hiddenAttrs=hiddenAttrs||[];
              var aKeys = hiddenAttrs.concat(Object.keys(a));
          Severity: Minor
          Found in lib/discrepances.js - About 1 hr to fix

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

            module.exports = function(config, preConfig) {
              config.set({
            
                // base path that will be used to resolve all patterns (eg. files, exclude)
                basePath: '',
            Severity: Minor
            Found in karma.conf.js - About 1 hr to fix

              Consider simplifying this complex logical expression.
              Open

                  if(opts.unordered) {
                      aKeys.forEach(function(key) { 
                          setPropertyIf(rv, key, !(key in b) && !isOfClassError && (!opts.notMemberAsUndefined || a[key] != undefined) ? {onlyLeft:a[key]} : nestedObject(a[key], b[key], opts));
                      });
                      bKeys.forEach(function(key) {
              Severity: Major
              Found in lib/discrepances.js - About 1 hr to fix

                Consider simplifying this complex logical expression.
                Open

                    if(opts.deltaNumber && (typeA === 'number' && typeB === 'number' || typeA === 'number' && !isNaN(b) || typeB === 'number' && !isNaN(a))){
                        if(opts.deltaNumber && Math.abs(a-b)<opts.deltaNumber){
                            return null;
                        }
                    }
                Severity: Major
                Found in lib/discrepances.js - About 1 hr to fix

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

                  function compareArrayElem(resultArray, a, b, index, opts) {
                  Severity: Minor
                  Found in lib/discrepances.js - About 35 mins to fix

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

                    function compare(typeOfObjects, keyA, keyB, valA, valB) {
                    Severity: Minor
                    Found in lib/discrepances.js - About 35 mins to fix

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

                      (function codenautasModuleDefinition(root, name, factory) {
                          /* global define */
                          /* istanbul ignore next */
                          if(typeof root.globalModuleName !== 'string'){
                              root.globalModuleName = name;
                      Severity: Minor
                      Found in lib/discrepances.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

                      Avoid too many return statements within this function.
                      Open

                                  return compareClasses(classA, a, b, opts);  
                      Severity: Major
                      Found in lib/discrepances.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                    return compare('classes',nameA,nameB,a,b);
                        Severity: Major
                        Found in lib/discrepances.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                  return compare('types',typeA,typeB,a,b);
                          Severity: Major
                          Found in lib/discrepances.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                if(variable instanceof Object) { return 'Object'; }
                            Severity: Major
                            Found in lib/discrepances.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                          return {classes:[nameA,nameB]};
                              Severity: Major
                              Found in lib/discrepances.js - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                        return opts.duckTyping?'Object':'#null__proto__';
                                Severity: Major
                                Found in lib/discrepances.js - About 30 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language