Function sanitize
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
function sanitize(doc, template) {
if (!doc.metadata || !template) {
return doc;
}
- 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 updateEntity
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
async function updateEntity(entity, _template, unrestricted = false) {
const docLanguages = await this.getAllLanguages(entity.sharedId);
if (
docLanguages[0].template &&
- 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 save
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async save(_doc, { user, language }, options = {}) {
const { updateRelationships = true, index = true, includeDocuments = true } = options;
await validateEntity(_doc);
await saveSelections(_doc);
const doc = _doc;
- 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
Consider simplifying this complex logical expression. Open
if (entity && entity.template) {
entity.metadata = entity.metadata || {};
const template = _templates.find(t => t._id.toString() === entity.template.toString());
const relationshipProperties = template.properties.filter(p => p.type === 'relationship');
Function deleteFromMetadata
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
async deleteFromMetadata(deletedId, propertyContent, propTypes) {
const includesRelationships = propTypes.includes(propertyTypes.relationship);
const allTemplates = await templates.get({
$or: [
{
- 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 extendSelect
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const extendSelect = select => {
if (!select) {
return select;
}
if (typeof select === 'string') {
- 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
Prefer named exports. Open
export default {
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Definition for rule 'node/no-restricted-import' was not found. Open
/* eslint-disable max-lines */
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/