Showing 11 of 24 total issues
Function parse
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
export function parse (rootParser: ExprParser, lexer: XPathLexer): NodeTestNode {
if (lexer.peak() === "*") {
lexer.next();
return {
- 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 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function parse (rootParser: ExprParser, lexer: XPathLexer): StepNode {
if (lexer.peak() === "..") {
lexer.next();
return {
Function parse
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
export function parse (rootParser: ExprParser, lexer: XPathLexer): ExprNode {
if (FilterExpr.isValidOp(lexer)) {
var filter = FilterExpr.parse(rootParser, lexer);
if (!lexer.empty() && lexer.peak()[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"
Further reading
Function parse
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function parse (rootParser: ExprParser, lexer: XPathLexer): NodeTestNode {
if (lexer.peak() === "*") {
lexer.next();
return {
Function parse
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export function parse (rootParser: ExprParser, lexer: XPathLexer): FunctionNode {
var functionName = lexer.peak() as string;
if (!isValid(functionName)) {
throw new Error("Invalid function at position " + lexer.position());
- 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 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function parse (rootParser: ExprParser, lexer: XPathLexer): ExprNode {
var token = lexer.peak(),
ch = token && token[0];
if (ch === "(") {
Function parse
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export function parse (rootParser: ExprParser, lexer: XPathLexer): ExprNode {
var token = lexer.peak(),
ch = token && token[0];
if (ch === "(") {
- 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 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function parse (rootParser: ExprParser, lexer: XPathLexer): ExprNode {
if (FilterExpr.isValidOp(lexer)) {
var filter = FilterExpr.parse(rootParser, lexer);
if (!lexer.empty() && lexer.peak()[0] === "/") {
Function parse
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function parse (rootParser: ExprParser, lexer: XPathLexer): FunctionNode {
var functionName = lexer.peak() as string;
if (!isValid(functionName)) {
throw new Error("Invalid function at position " + lexer.position());
Function parse
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export function parse (rootParser: ExprParser, lexer: XPathLexer): StepNode {
if (lexer.peak() === "..") {
lexer.next();
return {
- 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 8 (exceeds 5 allowed). Consider refactoring. Open
export function parse (rootParser: ExprParser, lexer: XPathLexer): AbsoluteLocationPathNode {
var absoluteLocation: AbsoluteLocationPathNode = {
type: ABSOLUTE_LOCATION_PATH,
steps: []
};
- 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"