src/EventeExpression.js
Function eval
has a Cognitive Complexity of 58 (exceeds 20 allowed). Consider refactoring. Open
Open
eval(model, item, property) {
if ( item === undefined )
item = this.tree;
let value, tmp, number, type = typeof item;
switch ( 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
Function parse_tree
has a Cognitive Complexity of 57 (exceeds 20 allowed). Consider refactoring. Open
Open
parse_tree(tokens, item) {
if ( item === undefined )
item = {};
if ( item.params === undefined )
item.params = [];
- 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
File EventeExpression.js
has 320 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
const EventeModel = require('./EventeModel');
const EventePipes = require('./EventePipes');
const EventeStrings = require('./EventeStrings');
/**
Function parse_tree
has 88 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
parse_tree(tokens, item) {
if ( item === undefined )
item = {};
if ( item.params === undefined )
item.params = [];
Function eval
has 67 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
eval(model, item, property) {
if ( item === undefined )
item = this.tree;
let value, tmp, number, type = typeof item;
switch ( type ) {
Avoid deeply nested control flow statements. Open
Open
if ( EventeExpression.operations[item.type].priority >= EventeExpression.operations['.'].priority )
item = {type: '.', params: [item, token]};
else
item.params.push({type: '.', params: [item.params.pop(), token]});
Avoid too many return
statements within this function. Open
Open
return item;