Showing 1,982 of 1,982 total issues

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

export function ConditionalExpression() {
  const argumentTypes = [
    this.get("consequent").getTypeAnnotation(),
    this.get("alternate").getTypeAnnotation(),
  ];
Severity: Major
Found in packages/babel-traverse/src/path/inference/inferers.js and 1 other location - About 4 hrs to fix
packages/babel-traverse/src/path/inference/inferers.js on lines 85..100

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 122.

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 3 locations. Consider refactoring.
Open

  if (isAccessor) {
    privateNamesMap.set(prop.node.key.id.name, {
      ...privateName,
      initAdded: true,
    });
packages/babel-helper-create-class-features-plugin/src/fields.js on lines 487..499
packages/babel-helper-create-class-features-plugin/src/fields.js on lines 536..551

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 122.

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 3 locations. Consider refactoring.
Open

  if (isAccessor) {
    privateNamesMap.set(prop.node.key.id.name, {
      ...privateName,
      initAdded: true,
    });
packages/babel-helper-create-class-features-plugin/src/fields.js on lines 462..477
packages/babel-helper-create-class-features-plugin/src/fields.js on lines 536..551

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 122.

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

export function LogicalExpression() {
  const argumentTypes = [
    this.get("left").getTypeAnnotation(),
    this.get("right").getTypeAnnotation(),
  ];
Severity: Major
Found in packages/babel-traverse/src/path/inference/inferers.js and 1 other location - About 4 hrs to fix
packages/babel-traverse/src/path/inference/inferers.js on lines 102..117

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 122.

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 exports has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function () {
  return {
    name: "babel-source",
    load(id) {
      const matches = id.match(/packages\/(babel-[^/]+)\/src\//);
Severity: Minor
Found in scripts/rollup-plugin-babel-source.js - About 4 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 parseSubscript has 106 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  parseSubscript(
    base: N.Expression,
    startPos: number,
    startLoc: Position,
    noCalls: ?boolean,
Severity: Major
Found in packages/babel-parser/src/parser/expression.js - About 4 hrs to fix

    Function parseParenAndDistinguishExpression has 104 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      parseParenAndDistinguishExpression(canBeArrow: boolean): N.Expression {
        const startPos = this.state.start;
        const startLoc = this.state.startLoc;
    
        let val;
    Severity: Major
    Found in packages/babel-parser/src/parser/expression.js - About 4 hrs to fix

      File corejs2-built-in-features.js has 338 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      const typedArrayMethods = [
        "typed arrays / %TypedArray%.from",
        "typed arrays / %TypedArray%.of",
        "typed arrays / %TypedArray%.prototype.subarray",
        "typed arrays / %TypedArray%.prototype.join",
      Severity: Minor
      Found in packages/babel-compat-data/scripts/data/corejs2-built-in-features.js - About 4 hrs to fix

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

        export function isExpressionWrapper(node: ?Object, opts?: Object): boolean {
          if (!node) return false;
        
          const nodeType = node.type;
          if (
        Severity: Major
        Found in packages/babel-types/src/validators/generated/index.js and 5 other locations - About 4 hrs to fix
        packages/babel-types/src/validators/generated/index.js on lines 3815..3833
        packages/babel-types/src/validators/generated/index.js on lines 4111..4129
        packages/babel-types/src/validators/generated/index.js on lines 4148..4166
        packages/babel-types/src/validators/generated/index.js on lines 4243..4261
        packages/babel-types/src/validators/generated/index.js on lines 4538..4556

        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 117.

        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 6 locations. Consider refactoring.
        Open

        export function isMethod(node: ?Object, opts?: Object): boolean {
          if (!node) return false;
        
          const nodeType = node.type;
          if (
        Severity: Major
        Found in packages/babel-types/src/validators/generated/index.js and 5 other locations - About 4 hrs to fix
        packages/babel-types/src/validators/generated/index.js on lines 3796..3814
        packages/babel-types/src/validators/generated/index.js on lines 3815..3833
        packages/babel-types/src/validators/generated/index.js on lines 4148..4166
        packages/babel-types/src/validators/generated/index.js on lines 4243..4261
        packages/babel-types/src/validators/generated/index.js on lines 4538..4556

        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 117.

        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 6 locations. Consider refactoring.
        Open

        export function isProperty(node: ?Object, opts?: Object): boolean {
          if (!node) return false;
        
          const nodeType = node.type;
          if (
        Severity: Major
        Found in packages/babel-types/src/validators/generated/index.js and 5 other locations - About 4 hrs to fix
        packages/babel-types/src/validators/generated/index.js on lines 3796..3814
        packages/babel-types/src/validators/generated/index.js on lines 3815..3833
        packages/babel-types/src/validators/generated/index.js on lines 4111..4129
        packages/babel-types/src/validators/generated/index.js on lines 4243..4261
        packages/babel-types/src/validators/generated/index.js on lines 4538..4556

        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 117.

        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 6 locations. Consider refactoring.
        Open

        export function isExportDeclaration(node: ?Object, opts?: Object): boolean {
          if (!node) return false;
        
          const nodeType = node.type;
          if (
        Severity: Major
        Found in packages/babel-types/src/validators/generated/index.js and 5 other locations - About 4 hrs to fix
        packages/babel-types/src/validators/generated/index.js on lines 3796..3814
        packages/babel-types/src/validators/generated/index.js on lines 3815..3833
        packages/babel-types/src/validators/generated/index.js on lines 4111..4129
        packages/babel-types/src/validators/generated/index.js on lines 4148..4166
        packages/babel-types/src/validators/generated/index.js on lines 4538..4556

        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 117.

        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 6 locations. Consider refactoring.
        Open

        export function isPrivate(node: ?Object, opts?: Object): boolean {
          if (!node) return false;
        
          const nodeType = node.type;
          if (
        Severity: Major
        Found in packages/babel-types/src/validators/generated/index.js and 5 other locations - About 4 hrs to fix
        packages/babel-types/src/validators/generated/index.js on lines 3796..3814
        packages/babel-types/src/validators/generated/index.js on lines 3815..3833
        packages/babel-types/src/validators/generated/index.js on lines 4111..4129
        packages/babel-types/src/validators/generated/index.js on lines 4148..4166
        packages/babel-types/src/validators/generated/index.js on lines 4243..4261

        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 117.

        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 6 locations. Consider refactoring.
        Open

        export function isFor(node: ?Object, opts?: Object): boolean {
          if (!node) return false;
        
          const nodeType = node.type;
          if (
        Severity: Major
        Found in packages/babel-types/src/validators/generated/index.js and 5 other locations - About 4 hrs to fix
        packages/babel-types/src/validators/generated/index.js on lines 3796..3814
        packages/babel-types/src/validators/generated/index.js on lines 4111..4129
        packages/babel-types/src/validators/generated/index.js on lines 4148..4166
        packages/babel-types/src/validators/generated/index.js on lines 4243..4261
        packages/babel-types/src/validators/generated/index.js on lines 4538..4556

        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 117.

        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 readNumber has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open

          readNumber(startsWithDot: boolean): void {
            const start = this.state.pos;
            let isFloat = false;
            let isBigInt = false;
            let isNonOctalDecimalInt = false;
        Severity: Minor
        Found in packages/babel-parser/src/tokenizer/index.js - About 4 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 parseParenAndDistinguishExpression has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open

          parseParenAndDistinguishExpression(canBeArrow: boolean): N.Expression {
            const startPos = this.state.start;
            const startLoc = this.state.startLoc;
        
            let val;
        Severity: Minor
        Found in packages/babel-parser/src/parser/expression.js - About 4 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 placeholderVisitorHandler has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open

        function placeholderVisitorHandler(
          node: BabelNode,
          ancestors: TraversalAncestors,
          state: MetadataState,
        ) {
        Severity: Minor
        Found in packages/babel-template/src/parse.js - About 4 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

        File introspection.js has 336 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        // This file contains methods responsible for introspecting the current path for certain values.
        
        import type NodePath from "./index";
        import includes from "lodash/includes";
        import * as t from "@babel/types";
        Severity: Minor
        Found in packages/babel-traverse/src/path/introspection.js - About 4 hrs to fix

          Consider simplifying this complex logical expression.
          Open

            if (
              nodeType === "JSX" ||
              "JSXAttribute" === nodeType ||
              "JSXClosingElement" === nodeType ||
              "JSXElement" === nodeType ||
          Severity: Critical
          Found in packages/babel-types/src/validators/generated/index.js - About 4 hrs to fix

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

            export function loadPreset(
              name: string,
              dirname: string,
            ): { filepath: string, value: mixed } {
              const filepath = resolvePreset(name, dirname);
            Severity: Major
            Found in packages/babel-core/src/config/files/plugins.js and 1 other location - About 4 hrs to fix
            packages/babel-core/src/config/files/plugins.js on lines 30..43

            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 115.

            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