Showing 1,982 of 1,982 total issues

Function parseObjectMember has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  parseObjectMember(
    isPattern: boolean,
    refExpressionErrors?: ?ExpressionErrors,
  ): N.ObjectMember | N.SpreadElement | N.RestElement {
    let decorators = [];
Severity: Minor
Found in packages/babel-parser/src/parser/expression.js - 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 checkReservedWord has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  checkReservedWord(
    word: string,
    startLoc: number,
    checkKeywords: boolean,
    isBinding: boolean,
Severity: Minor
Found in packages/babel-parser/src/parser/expression.js - 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 toAssignableList has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  toAssignableList(
    exprList: Expression[],
    trailingCommaPos?: ?number,
  ): $ReadOnlyArray<Pattern> {
    let end = exprList.length;
Severity: Minor
Found in packages/babel-parser/src/parser/lval.js - 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 toAssignable has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  toAssignable(node: Node): Node {
    let parenthesized = undefined;
    if (node.type === "ParenthesizedExpression" || node.extra?.parenthesized) {
      parenthesized = unwrapParenthesizedExpression(node);
      if (
Severity: Minor
Found in packages/babel-parser/src/parser/lval.js - 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 verifyUsedFeatures has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

export function verifyUsedFeatures(path, file) {
  if (hasOwnDecorators(path.node)) {
    if (!hasFeature(file, FEATURES.decorators)) {
      throw path.buildCodeFrameError(
        "Decorators are not enabled." +
Severity: Minor
Found in packages/babel-helper-create-class-features-plugin/src/features.js - 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 isBinding has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

export default function isBinding(
  node: Object,
  parent: Object,
  grandparent?: Object,
): boolean {
Severity: Minor
Found in packages/babel-types/src/validators/isBinding.js - 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 ObjectTypeAnnotation has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

export function ObjectTypeAnnotation(node: Object) {
  if (node.exact) {
    this.token("{|");
  } else {
    this.token("{");
Severity: Minor
Found in packages/babel-generator/src/generators/flow.js - 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 crawl has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  crawl() {
    const path = this.path;

    this.references = Object.create(null);
    this.bindings = Object.create(null);
Severity: Minor
Found in packages/babel-traverse/src/scope/index.js - 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 replaceWith has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

export function replaceWith(replacement) {
  this.resync();

  if (this.removed) {
    throw new Error("You can't replace this node, we've already removed it");
Severity: Minor
Found in packages/babel-traverse/src/path/replacement.js - 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 getScopeInformation has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

function getScopeInformation(fnPath) {
  const thisPaths = [];
  const argumentsPaths = [];
  const newTargetPaths = [];
  const superProps = [];
Severity: Minor
Found in packages/babel-traverse/src/path/conversion.js - 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 wrapClosure has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  wrapClosure() {
    if (this.throwIfClosureRequired) {
      throw this.blockPath.buildCodeFrameError(
        "Compiling let/const in this block would add a closure " +
          "(throwIfClosureRequired).",
Severity: Minor
Found in packages/babel-plugin-transform-block-scoping/src/index.js - 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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  withTopicPermittingContext<T>(callback: () => T): T {
    const outerContextTopicState = this.state.topicContext;
    this.state.topicContext = {
      // Enable the use of the primary topic reference.
      maxNumOfResolvableTopics: 1,
Severity: Major
Found in packages/babel-parser/src/parser/expression.js and 1 other location - About 2 hrs to fix
packages/babel-parser/src/parser/expression.js on lines 2446..2460

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 80.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  withTopicForbiddingContext<T>(callback: () => T): T {
    const outerContextTopicState = this.state.topicContext;
    this.state.topicContext = {
      // Disable the use of the primary topic reference.
      maxNumOfResolvableTopics: 0,
Severity: Major
Found in packages/babel-parser/src/parser/expression.js and 1 other location - About 2 hrs to fix
packages/babel-parser/src/parser/expression.js on lines 2423..2437

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 80.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function parseMaybeAssign has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    parseMaybeAssign(...args): N.Expression {
      // Note: When the JSX plugin is on, type assertions (`<T> x`) aren't valid syntax.

      let state: ?State;
      let jsx;
Severity: Major
Found in packages/babel-parser/src/plugins/typescript/index.js - About 2 hrs to fix

    Function checkExport has 56 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      checkExport(
        node: N.ExportNamedDeclaration,
        checkNames?: boolean,
        isDefault?: boolean,
        isFrom?: boolean,
    Severity: Major
    Found in packages/babel-parser/src/parser/statement.js - About 2 hrs to fix

      Function loadPrivatePartialConfig has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default function* loadPrivatePartialConfig(
        inputOpts: mixed,
      ): Handler<PrivPartialConfig | null> {
        if (
          inputOpts != null &&
      Severity: Major
      Found in packages/babel-core/src/config/partial.js - About 2 hrs to fix

        Function validate has 55 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function validate(opts: mixed): TemplateOpts {
          if (opts != null && typeof opts !== "object") {
            throw new Error("Unknown template options.");
          }
        
        
        Severity: Major
        Found in packages/babel-template/src/options.js - About 2 hrs to fix

          Function mergeSourceMap has 55 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default function mergeSourceMap(
            inputMap: SourceMap,
            map: SourceMap,
          ): SourceMap {
            const input = buildMappingData(inputMap);
          Severity: Major
          Found in packages/babel-core/src/transformation/file/merge-map.js - About 2 hrs to fix

            Function _guessExecutionStatusRelativeTo has 55 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function _guessExecutionStatusRelativeTo(
              target: NodePath,
            ): RelativeExecutionStatus {
              // check if the two paths are in different functions, we can't track execution of these
              const funcParent = {
            Severity: Major
            Found in packages/babel-traverse/src/path/introspection.js - About 2 hrs to fix

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                    if (this.match(tt.braceL)) {
                      this.scope.enter(SCOPE_TS_MODULE);
                      this.prodParam.enter(PARAM);
                      node.body = this.tsParseModuleBlock();
                      this.prodParam.exit();
              Severity: Major
              Found in packages/babel-parser/src/plugins/typescript/index.js and 1 other location - About 2 hrs to fix
              packages/babel-parser/src/plugins/typescript/index.js on lines 1296..1302

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 79.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Severity
              Category
              Status
              Source
              Language