Showing 10 of 41 total issues
Function evaluateWithObject
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
ComparisonPredicate.prototype.evaluateWithObject = function (o, vars) {
vars || (vars = this._substitutionVariables);
var leftExpressionValue = (this.left.type === 'variable' ? this.left.getValueWithObject(o, vars) : this.left.getValueWithObject(o));
var rightExpressionValue = (this.right.type === 'variable' ? this.right.getValueWithObject(o, vars) : this.right.getValueWithObject(o));
- 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
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
CompoundPredicate.parse = function (str, vars) {
var predicate;
function getParts (s) {
var matches = s.match(regex);
- 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
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
CompoundPredicate.parse = function (str, vars) {
var predicate;
function getParts (s) {
var matches = s.match(regex);
Function evaluateWithObject
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
ComparisonPredicate.prototype.evaluateWithObject = function (o, vars) {
vars || (vars = this._substitutionVariables);
var leftExpressionValue = (this.left.type === 'variable' ? this.left.getValueWithObject(o, vars) : this.left.getValueWithObject(o));
var rightExpressionValue = (this.right.type === 'variable' ? this.right.getValueWithObject(o, vars) : this.right.getValueWithObject(o));
Function splitByGates
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
function splitByGates (s) {
var subpredicates = [];
var gate;
var i;
var l;
Function evaluateWithObject
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
CompoundPredicate.prototype.evaluateWithObject = function (o, vars) {
vars || (vars = this._substitutionVariables);
var subpredicates = this.subpredicates;
var gate = this.gate;
- 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 (current) {
subpredicates.push(current);
}
Function ensurePredicate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function ensurePredicate (p, args) {
var Predicate = require('../predicate.js');
var predicate;
var type = typeof p;
- 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 getExpressions
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Predicate.getExpressions = function (p) {
var es = [];
if (p.left) { // comparison predicate
es.push(p.left);
- 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 ComparisonPredicate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function ComparisonPredicate (left, right, operator) {
this.type = 'comparison';
if (arguments.length === 1 && typeof arguments[0] === 'object') {
var o = arguments[0];
- 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"