lib/common/json-schema-validator.js
Function jsonSchemaValidatorFactory
has 183 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function jsonSchemaValidatorFactory(
Ajv,
assert,
nodeFs,
path,
Function jsonSchemaValidatorFactory
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
Open
function jsonSchemaValidatorFactory(
Ajv,
assert,
nodeFs,
path,
- Read upRead up
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 getSchemaResolved
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
JsonSchemaValidator.prototype.getSchemaResolved = function (name) {
var key = url.resolve(this.nameSpace, name);
var schemaCompiled = this._ajv.getSchema(key);
if (undefined === schemaCompiled) {
return;
Function addSchemasByDir
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
JsonSchemaValidator.prototype.addSchemasByDir = function (schemaDir, metaSchemaName) {
var self = this;
return Promise.try(function () {
assert.string(schemaDir, 'schemaDir');
if (metaSchemaName) {
Function validatePatternsSkipped
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
JsonSchemaValidator.prototype.validatePatternsSkipped = function (schema, data, skipPatterns) {
assert.equal(this.options.allErrors, true,
"option 'allErrors' need be enabled for validatePatternSkipped");
assert.equal(this.options.verbose, true,
"option 'verbose' need be enabled for validatePatternSkipped");
Function jsonSchemaValidatorFactory
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
Ajv,
assert,
nodeFs,
path,
Promise,