lib/modelToModel/intermediaryLayer.js

Summary

Maintainability
D
2 days
Test Coverage

Function extend has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

exports.extend = function(obj, $extend, registry) {
    'use strict';

    var ref = $extend || obj.$extend || false;

Severity: Minor
Found in lib/modelToModel/intermediaryLayer.js - About 5 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function mergeObjects has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

exports.mergeObjects = function(obj1, obj2) {
    return _.merge(obj1, obj2, function(objectValue, sourceValue, key) {

        if (_.isArray(objectValue)) {

Severity: Minor
Found in lib/modelToModel/intermediaryLayer.js - About 3 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

exports.extend = function(obj, $extend, registry) {
    'use strict';

    var ref = $extend || obj.$extend || false;

Severity: Major
Found in lib/modelToModel/intermediaryLayer.js - About 2 hrs to fix

    Function postProcessing has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    exports.postProcessing = function(modelPart) {
        'use strict';
    
        for (var key in modelPart) {
    
    
    Severity: Minor
    Found in lib/modelToModel/intermediaryLayer.js - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function inherit has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    exports.inherit = function(obj, registry) {
        'use strict';
    
        if (obj.$path) {
            exports.inheritanceStack.push(obj.$path);
    Severity: Minor
    Found in lib/modelToModel/intermediaryLayer.js - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function orderObjectProperties has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    exports.orderObjectProperties = function(obj) {
        'use strict';
    
        if (obj.properties) {
    
    
    Severity: Minor
    Found in lib/modelToModel/intermediaryLayer.js - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

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

    exports.mergeObjects = function(obj1, obj2) {
        return _.merge(obj1, obj2, function(objectValue, sourceValue, key) {
    
            if (_.isArray(objectValue)) {
    
    
    Severity: Minor
    Found in lib/modelToModel/intermediaryLayer.js - About 1 hr to fix

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

      exports.inherit = function(obj, registry) {
          'use strict';
      
          if (obj.$path) {
              exports.inheritanceStack.push(obj.$path);
      Severity: Minor
      Found in lib/modelToModel/intermediaryLayer.js - About 1 hr to fix

        Avoid deeply nested control flow statements.
        Open

                            if (obj.properties[obj.$remove[k]]) {
                                delete obj.properties[obj.$remove[k]];
                            } else {
                                log('[W] Cannot remove non existent property "' + obj.$remove[k] + '"');
                            }
        Severity: Major
        Found in lib/modelToModel/intermediaryLayer.js - About 45 mins to fix

          There are no issues that match your filters.

          Category
          Status