Function resolveSchemaRefs
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
function resolveSchemaRefs(val, validator, _root) {
_root = _root || val;
resolve(val, '', val);
return val;
- 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 getPaginationMeta
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function getPaginationMeta(opt) {
opt = opt || {};
opt.limit = typeof opt.limit !== 'number' ?
- 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 registerCustomKeywords
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function registerCustomKeywords(ajv) {
//register $desc - aka. property description keyword
ajv.addKeyword('$desc', {
schema: false,
valid: true,
Function resolveSchemaRefs
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function resolveSchemaRefs(val, validator, _root) {
_root = _root || val;
resolve(val, '', val);
return val;
Function getPaginationMeta
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getPaginationMeta(opt) {
opt = opt || {};
opt.limit = typeof opt.limit !== 'number' ?
Function resolve
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function resolve(val, key, object) {
if (_.isPlainObject(val)) {
if ( val.hasOwnProperty('$ref')
&& typeof val.$ref === 'string'
) {
Function _stderr
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function _stderr(err) {
if (typeof err === 'object' && err !== null) {
if (err.toLogger instanceof Function) {
err = err.toLogger();
- 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 validate
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
validate: function(schema, data, parentSchema, dataPath, parentData, prop) {