Showing 71 of 138 total issues
Avoid deeply nested control flow statements. Open
Open
if (stopSymbol) {
currentArgument.pos = Pos.unite(
currentArgument.pos,
this.tokenStream.previousToken().pos
);
Avoid deeply nested control flow statements. Open
Open
if (realArgumentCount < argumentCount.min) {
errorPos = realArgumentCount
? Pos.unite(
Pos.ending(treeNode.subNodes[realArgumentCount - 1].pos),
Pos.ending(treeNode.argumentPos)
Avoid deeply nested control flow statements. Open
Open
if (e != this.COULD_NOT_CALCULATE_EXCEPTION) {
throw e;
}
Avoid deeply nested control flow statements. Open
Open
if (this.tokenStream.currentToken().type == TokenType.COMMA
|| this.tokenStream.currentToken().type == TokenType.SEMICOLON) {
// It is an error if it is a semicolon
if (this.tokenStream.currentToken().type == TokenType.SEMICOLON) {
this.errors.add(new Message(
Avoid deeply nested control flow statements. Open
Open
} else if (realArgumentCount < argumentCount) {
errorPos = realArgumentCount
? Pos.unite(Pos.ending(
treeNode.subNodes[realArgumentCount - 1].pos),
Pos.ending(treeNode.argumentPos)
Avoid deeply nested control flow statements. Open
Open
if (moveCursor) {
this.cursorPos = i;
}
Avoid deeply nested control flow statements. Open
Open
if (!(this.tokenStream.previousToken().isErrorToken() && !this.tokenStream.previousToken().isMathOperator())
|| this.tokenStream.previousToken().isNumber()) {
this.errors.add(new Message('e_syn_missing_multiply',
Pos.between(
this.tokenStream.previousToken().pos,
Avoid deeply nested control flow statements. Open
Open
if (!this.tokenStream.currentToken().isEOF()) {
// If the content of the parsed part of the expression
// is a single factor, add it as the sub-node for this expression.
// This is made for further semantic check of it.
if (currentArgument.type == TreeNodeType.SYMBOL
Avoid deeply nested control flow statements. Open
Open
if (realArgumentCount < argumentCount.min) {
errorPos = realArgumentCount
? Pos.unite(
Pos.ending(treeNode.subNodes[realArgumentCount - 1].pos),
Pos.ending(treeNode.argumentPos)
Avoid deeply nested control flow statements. Open
Open
if (this.tokenStream.currentToken().isRightBracket()) {
// Get the position of the current node
currentNode.pos = Pos.unite(
firstNodeToken.pos,
this.tokenStream.currentToken().pos
Avoid deeply nested control flow statements. Open
Open
if (stopSymbol.isRightBracket()) {
currentNode.pos = Pos.unite(
firstNodeToken.pos,
this.tokenStream.currentToken().pos
);
Avoid deeply nested control flow statements. Open
Open
if (this.tokenStream.currentToken().isRightBracket()
|| this.tokenStream.currentToken().type == TokenType.COMMA
|| this.tokenStream.currentToken().type == TokenType.SEMICOLON) {
// Check if an argument is empty and add an error if so
if (currentArgument.type == TreeNodeType.EMPTY) {
Consider simplifying this complex logical expression. Open
Open
if (this.tokenStream.currentToken().isTermSign()
|| (this.tokenStream.currentToken().isErrorToken()
&& !this.tokenStream.currentToken().isStatementSign()
&& !this.tokenStream.currentToken().isNumber()
&& !this.tokenStream.currentToken().isLeftBracket() && !this.tokenStream
Consider simplifying this complex logical expression. Open
Open
if (!nextToken
|| !(nextToken.isMathOperator() || nextToken.isNumber()
|| nextToken.isSymbol() || nextToken
.isLeftBracket())
&& nextToken.type !== TokenType.E_REST) {
Consider simplifying this complex logical expression. Open
Open
if (currentToken.type != TokenType.SUBTRACT
&& (!previousToken || !(previousToken.isMathOperator()
|| previousToken.isRightBracket()
|| previousToken.isNumber() || previousToken
.isSymbol()))) {
Function skipSpaces
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
skipSpaces() {
for (var i = 0; i < this.temp.raw.length; i++) {
if (this.temp.raw.charAt(i) == '\n') {
this.temp.row++;
this.temp.pos++;
- 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 too many return
statements within this function. Open
Open
return currentNode;
Avoid too many return
statements within this function. Open
Open
return NaN;
Avoid too many return
statements within this function. Open
Open
return;
Avoid too many return
statements within this function. Open
Open
return;