Function enhanceWithForm
has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring. Open
exports.enhanceWithForm = function(objCollection, formSchema) {
if (formSchema && formSchema.$path) {
var newCollection = [];
- 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 enhanceWithForm
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.enhanceWithForm = function(objCollection, formSchema) {
if (formSchema && formSchema.$path) {
var newCollection = [];
Function validate
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
exports.validate = function(objCollection, registry) {
var errors = 0;
for (var i = 0; i < objCollection.length; i++) {
- 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 objToTemplate
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
exports.objToTemplate = function(name, obj) {
if (!obj || Object.keys(obj).length === 0) {
return '{{' + name + '}}\n'; // No unnecessary linebreaks
}
- 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
} else if (template.wikitext) {
// Ignore "wikitext" properties, since they'll only be rendered on the form edit page
if (exports.settings.debug) {
log('[D] Ignoring form-only "wikitext" injection');
Avoid deeply nested control flow statements. Open
for (var i = 0; i < items.length; i++) {
if (exports.settings.verbose) {
log('[D] Inserting multiple instance template: ' + templateName);
}
newCollection.push(items[i]);
Avoid deeply nested control flow statements. Open
if (exports.settings.verbose) {
log('[D] Appending wikitext: ' + obj);
}
Function objCollectionToWikitext
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
exports.objCollectionToWikitext = function(objCollection) {
var wikitext = '';
for (var i = 0; i < objCollection.length; i++) {
- 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 objToFunction
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
exports.objToFunction = function(name, obj) {
var wikitext = '{{' + name + ':\n';
for (var propertyName in obj) {
- 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"