Showing 9 of 27 total issues
Function validateSchema
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
function validateSchema (schema, pathArray, noTypes) {
for (let propName in schema) {
let prop = schema[propName]
if (noTypes) {
- 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 validateObject
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
const validateObject = function (object, schema, siblings, globals) {
const errors = {}
for (let propName in schema) {
const propValue = object ? object[propName] : null
const propDefinition = schema[propName]
- 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 buildConfig
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
const buildConfig = (env) => {
let libraryName = pkg.name
let plugins = [], outputFile
plugins.push( new webpack.DefinePlugin({
Function executeValidator
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const executeValidator = function (propValue, propDefinition, siblings, globals) {
if (propDefinition.valueType === ValueTypes.value) {
return runFunctions(propValue, propDefinition.validators, propDefinition.getter, siblings, globals)
} else {
// execute the value validation first
- 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 validateSchema
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function validateSchema (schema, pathArray, noTypes) {
for (let propName in schema) {
let prop = schema[propName]
if (noTypes) {
Function PropertyDefinition
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
export function PropertyDefinition (valueType, getter, validators = [], typeValidator = null, transform = null, collectionValidator = null) {
Function validateValidators
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const validateValidators = (validationType, validators, argumentName = 'validators') => {
let valid = false
if (isNil(validators)) {
valid = true
} else if (validationType === ValueTypes.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 transformWithPropDefinition
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const transformWithPropDefinition = (propValue, propDefinition) => {
if (propDefinition.valueType === ValueTypes.value) {
return propDefinition.transform(propValue)
} else if (isArray(propValue) && propDefinition.collectionValidator.indexOf(isOfTypeArray) > -1) {
const valueValidator = propDefinition.validators
- 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 transformObject
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function transformObject (object, schema) {
const ret = {}
for (let propName in object) {
const propValue = object[propName]
const propDefinition = schema[propName]
- 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"