Showing 32 of 74 total issues
Function is
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
is: function() {
if (this.filter === Object || this.filter === isMap[Object]) {
this.success = _.isPlainObject(this.val);
} else if (this.filter === Array || this.filter === isMap[Array]) {
this.success = this.val instanceof Array;
- 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 build
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Validator.prototype.build = function(data, where, options, parentDataObj, parentProp, parentTreeObj) {
Avoid deeply nested control flow statements. Open
if (fun instanceof Function) {
pool.push(fun);
}
Avoid deeply nested control flow statements. Open
} else if (_.isPlainObject(where[prefixedProp]) ) {
var required = where.hasOwnProperty(requiredKeyword) ? where[requiredKeyword] : options.required;
var nullable = where.hasOwnProperty(nullableKeyword) ? where[nullableKeyword] : options.nullable;
Function addSanitizer
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Validator.prototype.addSanitizer = function(sanitizerProp, where, parentDataObj, parentProp, options) {
Function buildArrayCondition
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Validator.prototype.buildArrayCondition = function(prop, data, where, options, parentTreeObj) {
Function buildObjectCondition
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Validator.prototype.buildObjectCondition = function(prop, data, where, options, parentTreeObj) {
Function hasLengthOf
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
hasLengthOf: function() {
if (this.val instanceof Array) {
var defaults = {
min: 0,
max: undefined
- 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 buildObjectCondition
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Validator.prototype.buildObjectCondition = function(prop, data, where, options, parentTreeObj) {
var path = options.propPath ? options.propPath + '.' + prop : prop;
var keywordPrefix = options.keywordPrefix;
var requiredKeyword = keywordPrefix + 'required';
var messageKeyword = keywordPrefix + 'message';
- 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 a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Validator.prototype.validate = function(data, customSchema, options) {
var self = this;
options = options || {};
this.error = null; //TODO ?
- 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
Avoid too many return
statements within this function. Open
return;
Function minMaxOrBoth
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function minMaxOrBoth(def, opt, context) {
var out = def.both;
if (_.isPlainObject(opt)) {
context.min = opt.min;
- 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"