ikuseiGmbH/smart-village-app-cms

View on GitHub
lib/jsonform-defaults.js

Summary

Maintainability
C
1 day
Test Coverage

Function setDefaultValues has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  var setDefaultValues = function (obj, schema, includeOptionalValues, skipFieldsWithoutDefaultValue) {
    if (!obj || !schema) return obj;
    if (!schema.properties) {
      schema = { properties: schema };
    }
Severity: Major
Found in lib/jsonform-defaults.js - About 2 hrs to fix

    Function setObjKey has 57 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      var setObjKey = function (obj, key, value) {
        var keyparts = key.split('.');
    
        // Recursive version of setObjKey
        var recSetObjKey = function (obj, keyparts, value) {
    Severity: Major
    Found in lib/jsonform-defaults.js - About 2 hrs to fix

      Function recSetObjKey has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          var recSetObjKey = function (obj, keyparts, value) {
            var arrayMatch = null;
            var reArray = /\[([0-9]*)\]$/;
            var subkey = keyparts.shift();
            var idx = 0;
      Severity: Minor
      Found in lib/jsonform-defaults.js - About 2 hrs to fix

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

            var extractDefaultValues = function (schemaItem, path) {
              var properties = null;
              var child = null;
        
              if (!schemaItem || (schemaItem !== Object(schemaItem))) return null;
        Severity: Minor
        Found in lib/jsonform-defaults.js - About 1 hr to fix

          TODO found
          Open

                    // TODO: review that! Only create the right item!!!
          Severity: Minor
          Found in lib/jsonform-defaults.js by fixme

          Parsing error: parser.parse is not a function
          Open

          /**
          Severity: Minor
          Found in lib/jsonform-defaults.js by eslint

          For more information visit Source: http://eslint.org/docs/rules/

          There are no issues that match your filters.

          Category
          Status