codenautas/discrepances

View on GitHub

Showing 21 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

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

            bKeys.forEach(function(key) {
                setPropertyIf(rv, key, !(key in a) && !isOfClassError && (!opts.notMemberAsUndefined || a[key] != undefined) ? {onlyRight:b[key]} : nestedObject(a[key], b[key], opts));
            });
    Severity: Major
    Found in lib/discrepances.js and 1 other location - About 2 hrs to fix
    lib/discrepances.js on lines 155..157

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

    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

            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));
            });
    Severity: Major
    Found in lib/discrepances.js and 1 other location - About 2 hrs to fix
    lib/discrepances.js on lines 158..160

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

    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

    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

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

                        if(timesDiffer) {
                            res.push(' ');
                            res.push(bbs[1].substr(0, b.getMilliseconds()?12:8));
                        }
                Severity: Major
                Found in lib/discrepances.js and 1 other location - About 1 hr to fix
                lib/discrepances.js on lines 124..127

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

                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

                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

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

                          if(timesDiffer) {
                              res.push(' ');
                              res.push(aas[1].substr(0, a.getMilliseconds()?12:8));
                          }
                  Severity: Major
                  Found in lib/discrepances.js and 1 other location - About 1 hr to fix
                  lib/discrepances.js on lines 130..133

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

                  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

                  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
                                Severity
                                Category
                                Status
                                Source
                                Language