Showing 12 of 19 total issues
Function readString
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
export const readString: Tokenizer = (lexer, start, quoteCode) => {
const source = lexer.source;
const body = source.body;
const bodyLength = body.length;
let position = start + 1;
- 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 readString
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const readString: Tokenizer = (lexer, start, quoteCode) => {
const source = lexer.source;
const body = source.body;
const bodyLength = body.length;
let position = start + 1;
Function addDefaultTokenizers
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const addDefaultTokenizers = (lexer: Lexer) => {
lexer.add(0x0023, (lexer, position, code) => readComment(lexer, position, code));
lexer.add(0x002f, (lexer, position, code) => {
if (lexer.source.body[position + 1].charCodeAt(0) === 0x002f) {
Function readNumber
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const readNumber: Tokenizer = (lexer, start, firstCode) => {
const source = lexer.source;
const body = source.body;
let position = start;
let code = firstCode;
Function readNumber
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export const readNumber: Tokenizer = (lexer, start, firstCode) => {
const source = lexer.source;
const body = source.body;
let position = start;
let code = firstCode;
- 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 getValue
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
const getValue = (parser: Parser): ValueNode => {
const token = parser.lexer.token;
parser.advanceLexer();
switch (token.kind) {
case TokenKind.NUMBER:
Function readEscapedCharacter
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
readEscapedCharacter(position: number): EscapeSequence {
const body = this.body;
const code = body.charCodeAt(position + 1);
switch (code) {
case 0x0022: // "
Function readEscapedUnicodeVariableWidth
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
readEscapedUnicodeVariableWidth(position: number): EscapeSequence {
const body = this.body;
let point = 0;
let size = 3;
while (size < 12) {
- 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 readComment
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const readComment: Tokenizer = (lexer, start) => {
const body = lexer.source.body;
const bodyLength = body.length;
let position = start + 1;
- 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 readEscapedUnicodeFixedWidth
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
readEscapedUnicodeFixedWidth(position: number): EscapeSequence {
const body = this.body;
const code = read16BitHexCode(body, position + 2);
if (isUnicodeScalarValue(code)) {
- 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 lookahead
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
lookahead(): Token {
let token = this.token;
if (token.kind !== TokenKind.EOF) {
do {
if (token.next) {
- 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 add
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
add<N extends Node>(nodeParser: NodeParser<N>): void {
if (nodeParser.trigger) {
if (!this._parsersMap.has(nodeParser.trigger.kind)) {
this._parsersMap.set(nodeParser.trigger.kind, new Map);
}
- 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"