packages/babel-parser/src/tokenizer/context.js

Summary

Maintainability
A
3 hrs
Test Coverage

Consider simplifying this complex logical expression.
Open

  } else if (
    prevType.beforeExpr &&
    prevType !== tt.semi &&
    prevType !== tt._else &&
    !(
Severity: Critical
Found in packages/babel-parser/src/tokenizer/context.js - About 1 hr to fix

    Consider simplifying this complex logical expression.
    Open

        if (
          (this.state.value === "of" &&
            !this.state.exprAllowed &&
            prevType !== tt._function &&
            prevType !== tt._class) ||
    Severity: Major
    Found in packages/babel-parser/src/tokenizer/context.js - About 40 mins to fix

      Function updateContext has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      tt._function.updateContext = tt._class.updateContext = function (prevType) {
        if (prevType === tt.dot || prevType === tt.questionDot) {
          // when function/class follows dot/questionDot, it is part of
          // (optional)MemberExpression, then we don't need to push new token context
        } else if (
      Severity: Minor
      Found in packages/babel-parser/src/tokenizer/context.js - About 35 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 updateContext has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      tt.name.updateContext = function (prevType) {
        let allowed = false;
        if (prevType !== tt.dot) {
          if (
            (this.state.value === "of" &&
      Severity: Minor
      Found in packages/babel-parser/src/tokenizer/context.js - About 35 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

      There are no issues that match your filters.

      Category
      Status