Function validateExpandedRegistry
has a Cognitive Complexity of 74 (exceeds 5 allowed). Consider refactoring. Open
exports.validateExpandedRegistry = function(registry) {
'use strict';
return new Promise(function(resolve) {
- 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 validateExpandedRegistry
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.validateExpandedRegistry = function(registry) {
'use strict';
return new Promise(function(resolve) {
Function validateRegistry
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
exports.validateRegistry = function(registry) {
'use strict';
return new Promise(function(resolve) {
- 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 8 (exceeds 5 allowed). Consider refactoring. Open
exports.validate = function(json, schema, name) {
'use strict';
var id = json.$path || json.id || name || '(unknown)';
- 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 deeply nested control flow statements. Open
if (intersection.length > 0) {
log ('[W] ' + id + ': "recommended" and "required" define the same fields: ' + intersection.join(', '));
}
Function arrayReferencesObjectKey
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
exports.arrayReferencesObjectKey = function(obj, arrayName, objName) {
if (obj[objName]) {
for (var j = 0; j < obj[arrayName].length; j++) {
var requirement = obj[arrayName][j];
if (!obj.properties[requirement] && requirement !== '*') {
- 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"