Showing 30 of 30 total issues
Function equalTo
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
equalTo: function(def, value, key, errors, data) {
Function validate
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
validate: function(def, value, key, errors, initData) {
Function requireIf
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
requireIf: function(def, value, key, errors, data) {
Function requiredIf
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
requiredIf: function(def, value, key, errors, data) {
Function requireIfNot
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
requireIfNot: function(def, value, key, errors, data) {
Function allow
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
allow: function(def, value, key, errors) {
const type = 'allow'
const sub = typeof def.allow === 'object' && !Array.isArray(def.allow) ? Object.keys(def.allow) : def.allow
const subIsArray = Array.isArray(sub)
if ((subIsArray && sub.indexOf(value) === -1) || (!subIsArray && sub !== value)) {
- 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 check
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
check: context => {
if (!types.strategies[context.def.type]) {
if (context.def.type.match(/[\/\\]/)) {
throw new Error(`Illegal type name: ${context.def.type}`)
}
- 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 rules.props.default
Avoid too many return
statements within this function. Open
return Promise.all(promises)
Function default
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
default: context => {
// Ensure array
if (!Array.isArray(context.value)) {
return context.fail('Value must be an 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"