Showing 71 of 138 total issues
Function addInverseTrigonometricFunctions
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
addInverseTrigonometricFunctions() {
// Arcsine
this.addFunction({
'arcsin': HumaneMath.Dialect.WEST,
Function validate
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
validate(tree, symbols, rules, calculator) {
this.errors.clear();
// Check for emptiness
Function checkForMissedOperands
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
checkForMissedOperands() {
this.tokenStream.firstToken(true);
var previousToken;
var currentToken;
var nextToken;
- 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 16 (exceeds 5 allowed). Consider refactoring. Open
validate(tree, symbols, rules, calculator) {
this.errors.clear();
// Check for emptiness
- 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 addTrigonometricFunctions
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
addTrigonometricFunctions() {
// Sine
this.addFunction({
'sin': HumaneMath.Dialect.WEST,
Function checkForMissedOperands
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
checkForMissedOperands() {
this.tokenStream.firstToken(true);
var previousToken;
var currentToken;
var nextToken;
Function addNonMathFunctions
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
addNonMathFunctions() {
// Maximum value
this.addFunction({
'max': HumaneMath.Dialect.WEST,
Function addInverseHyperbolicTrigonometricFunctions
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
addInverseHyperbolicTrigonometricFunctions() {
// Hyperbolic arcsine
this.addFunction({
'arcsinh': HumaneMath.Dialect.WEST,
'arsh': HumaneMath.Dialect.EAST
Function subparseExpression
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
subparseExpression() {
var currentNode = this.createEmptyTreeNode();
var firstNodeToken = this.tokenStream.currentToken();
// Extract the first possible sub-node (term)
Function addHyperbolicTrigonometricFunctions
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
addHyperbolicTrigonometricFunctions() {
// Hyperbolic sine
this.addFunction({
'sinh': HumaneMath.Dialect.WEST,
Consider simplifying this complex logical expression. Open
if (this.tokenStream.currentToken().isErrorToken()
&& !this.tokenStream.currentToken().isMathOperator()
&& !this.tokenStream.currentToken().isRightBracket()) {
currentNode.type = TreeNodeType.UNPARSED;
while ((
Function testBrowser
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function testBrowser() {
// Our testing bundle is made up of our unit tests, which
// should individually load up pieces of our application.
// We also include the browser setup file.
const testFiles = glob.sync('./test/unit/**/*.js');
Function addMiscFunctions
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
addMiscFunctions() {
// Abs
this.addFunction({
'abs': HumaneMath.Dialect.WEST,
'modulus': HumaneMath.Dialect.MISC,
Function findNextToken
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
findNextToken(tokenTypes, moveCursor) {
if (!_.isArray(tokenTypes)) {
tokenTypes = [tokenTypes];
}
- 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 subparseStatement
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
subparseStatement() {
var currentNode = this.createEmptyTreeNode();
var firstNodeToken = this.tokenStream.currentToken();
var leftPart = this.subparseExpression();
- 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 findNextTokenAtTheSameLevel
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
findNextTokenAtTheSameLevel(tokenTypes, moveCursor) {
if (!_.isArray(tokenTypes)) {
tokenTypes = [tokenTypes];
}
Function subparsePower
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
subparsePower() {
var currentNode = this.createEmptyTreeNode();
var firstNodeToken = this.tokenStream.currentToken();
// Extract the first possible sub-node (power)
Function subparseExpression
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
subparseExpression() {
var currentNode = this.createEmptyTreeNode();
var firstNodeToken = this.tokenStream.currentToken();
// Extract the first possible sub-node (term)
- 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 (treeNode.subNodes[argumentCount - 1]) {
errorPos = Pos.unite(
Pos.ending(treeNode.subNodes[argumentCount - 1].pos),
Pos.ending(treeNode.argumentPos)
);
Avoid deeply nested control flow statements. Open
} if (realArgumentCount > argumentCount.max) {
errorPos = Pos.unite(
Pos.ending(treeNode.subNodes[argumentCount.max - 1].pos),
Pos.ending(treeNode.argumentPos)
);