badeball/xpath-analyzer

View on GitHub

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 {
Severity: Minor
Found in lib/parsers/node_test.ts - About 2 hrs to fix

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 {
Severity: Minor
Found in lib/parsers/step.ts - About 1 hr to fix

    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] === "/") {
    Severity: Minor
    Found in lib/parsers/path_expr.ts - About 1 hr to fix

    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 {
    Severity: Minor
    Found in lib/parsers/node_test.ts - About 1 hr to fix

      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());
      Severity: Minor
      Found in lib/parsers/function_call.ts - About 1 hr to fix

      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 === "(") {
      Severity: Minor
      Found in lib/parsers/primary_expr.ts - About 1 hr to fix

        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 === "(") {
        Severity: Minor
        Found in lib/parsers/primary_expr.ts - About 1 hr to fix

        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] === "/") {
        Severity: Minor
        Found in lib/parsers/path_expr.ts - About 1 hr to fix

          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());
          Severity: Minor
          Found in lib/parsers/function_call.ts - About 1 hr to fix

            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 {
            Severity: Minor
            Found in lib/parsers/step.ts - About 55 mins to fix

            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: []
              };
            Severity: Minor
            Found in lib/parsers/absolute_location_path.ts - About 45 mins to fix

            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

            Severity
            Category
            Status
            Source
            Language