Showing 1,982 of 1,982 total issues

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

export function isBinary(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 7 other locations - About 3 hrs to fix
packages/babel-types/src/validators/generated/index.js on lines 3739..3756
packages/babel-types/src/validators/generated/index.js on lines 3778..3795
packages/babel-types/src/validators/generated/index.js on lines 3834..3851
packages/babel-types/src/validators/generated/index.js on lines 4130..4147
packages/babel-types/src/validators/generated/index.js on lines 4167..4184
packages/babel-types/src/validators/generated/index.js on lines 4205..4222
packages/babel-types/src/validators/generated/index.js on lines 4449..4466

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

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

export function isClass(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 7 other locations - About 3 hrs to fix
packages/babel-types/src/validators/generated/index.js on lines 3524..3541
packages/babel-types/src/validators/generated/index.js on lines 3739..3756
packages/babel-types/src/validators/generated/index.js on lines 3778..3795
packages/babel-types/src/validators/generated/index.js on lines 3834..3851
packages/babel-types/src/validators/generated/index.js on lines 4130..4147
packages/babel-types/src/validators/generated/index.js on lines 4167..4184
packages/babel-types/src/validators/generated/index.js on lines 4449..4466

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

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

export function isFlowPredicate(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 7 other locations - About 3 hrs to fix
packages/babel-types/src/validators/generated/index.js on lines 3524..3541
packages/babel-types/src/validators/generated/index.js on lines 3739..3756
packages/babel-types/src/validators/generated/index.js on lines 3778..3795
packages/babel-types/src/validators/generated/index.js on lines 3834..3851
packages/babel-types/src/validators/generated/index.js on lines 4130..4147
packages/babel-types/src/validators/generated/index.js on lines 4167..4184
packages/babel-types/src/validators/generated/index.js on lines 4205..4222

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

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

      if (this.match(tt.bracketL)) {
        let braceStackCounter = 1;
        this.next();

        while (braceStackCounter > 0) {
Severity: Major
Found in packages/babel-parser/src/plugins/typescript/index.js and 1 other location - About 3 hrs to fix
packages/babel-parser/src/plugins/typescript/index.js on lines 904..917

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

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

    post() {
      if (this.opts.debug && this.usesRegenerator) {
        let filename = this.file.opts.filename;
        // normalize filename to generate consistent preset-env test fixtures
        if (process.env.BABEL_ENV === "test") {
packages/babel-preset-env/src/polyfills/regenerator/entry-plugin.js on lines 34..45

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

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

export function isObjectMember(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 7 other locations - About 3 hrs to fix
packages/babel-types/src/validators/generated/index.js on lines 3524..3541
packages/babel-types/src/validators/generated/index.js on lines 3739..3756
packages/babel-types/src/validators/generated/index.js on lines 3778..3795
packages/babel-types/src/validators/generated/index.js on lines 3834..3851
packages/babel-types/src/validators/generated/index.js on lines 4167..4184
packages/babel-types/src/validators/generated/index.js on lines 4205..4222
packages/babel-types/src/validators/generated/index.js on lines 4449..4466

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

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

export function isConditional(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 7 other locations - About 3 hrs to fix
packages/babel-types/src/validators/generated/index.js on lines 3524..3541
packages/babel-types/src/validators/generated/index.js on lines 3778..3795
packages/babel-types/src/validators/generated/index.js on lines 3834..3851
packages/babel-types/src/validators/generated/index.js on lines 4130..4147
packages/babel-types/src/validators/generated/index.js on lines 4167..4184
packages/babel-types/src/validators/generated/index.js on lines 4205..4222
packages/babel-types/src/validators/generated/index.js on lines 4449..4466

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

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

    post() {
      if (this.opts.debug && this.regeneratorImportExcluded) {
        let filename = this.file.opts.filename;
        // normalize filename to generate consistent preset-env test fixtures
        if (process.env.BABEL_ENV === "test") {
packages/babel-preset-env/src/polyfills/regenerator/usage-plugin.js on lines 22..33

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

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

export function isUnaryLike(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 7 other locations - About 3 hrs to fix
packages/babel-types/src/validators/generated/index.js on lines 3524..3541
packages/babel-types/src/validators/generated/index.js on lines 3739..3756
packages/babel-types/src/validators/generated/index.js on lines 3778..3795
packages/babel-types/src/validators/generated/index.js on lines 3834..3851
packages/babel-types/src/validators/generated/index.js on lines 4130..4147
packages/babel-types/src/validators/generated/index.js on lines 4205..4222
packages/babel-types/src/validators/generated/index.js on lines 4449..4466

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

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

export function isForXStatement(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 7 other locations - About 3 hrs to fix
packages/babel-types/src/validators/generated/index.js on lines 3524..3541
packages/babel-types/src/validators/generated/index.js on lines 3739..3756
packages/babel-types/src/validators/generated/index.js on lines 3778..3795
packages/babel-types/src/validators/generated/index.js on lines 4130..4147
packages/babel-types/src/validators/generated/index.js on lines 4167..4184
packages/babel-types/src/validators/generated/index.js on lines 4205..4222
packages/babel-types/src/validators/generated/index.js on lines 4449..4466

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

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

      if (this.match(tt.braceL)) {
        let braceStackCounter = 1;
        this.next();

        while (braceStackCounter > 0) {
Severity: Major
Found in packages/babel-parser/src/plugins/typescript/index.js and 1 other location - About 3 hrs to fix
packages/babel-parser/src/plugins/typescript/index.js on lines 919..932

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

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 standardizeSuperProperty has 92 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function standardizeSuperProperty(superProp) {
  if (
    superProp.parentPath.isAssignmentExpression() &&
    superProp.parentPath.node.operator !== "="
  ) {
Severity: Major
Found in packages/babel-traverse/src/path/conversion.js - About 3 hrs to fix

    Consider simplifying this complex logical expression.
    Open

      if (
        nodeType === "TSBaseType" ||
        "TSAnyKeyword" === nodeType ||
        "TSBooleanKeyword" === nodeType ||
        "TSBigIntKeyword" === nodeType ||
    Severity: Critical
    Found in packages/babel-types/src/validators/generated/index.js - About 3 hrs to fix

      File experimental.js has 319 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      // @flow
      import defineType, {
        assertOptionalChainStart,
        assertEach,
        assertNodeType,
      Severity: Minor
      Found in packages/babel-types/src/definitions/experimental.js - About 3 hrs to fix

        Function applyTargetDecorators has 90 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function applyTargetDecorators(path, state, decoratedProps) {
          const name = path.scope.generateDeclaredUidIdentifier(
            path.isClass() ? "class" : "obj",
          );
        
        
        Severity: Major
        Found in packages/babel-plugin-proposal-decorators/src/transformer-legacy.js - About 3 hrs to fix

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

              key: {
                validate: (function () {
                  const normal = assertNodeType(
                    "Identifier",
                    "StringLiteral",
          Severity: Major
          Found in packages/babel-types/src/definitions/core.js and 1 other location - About 3 hrs to fix
          packages/babel-types/src/definitions/core.js on lines 805..827

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

          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

              key: {
                validate: (function () {
                  const normal = assertNodeType(
                    "Identifier",
                    "StringLiteral",
          Severity: Major
          Found in packages/babel-types/src/definitions/core.js and 1 other location - About 3 hrs to fix
          packages/babel-types/src/definitions/core.js on lines 740..762

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

          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

          File caching.js has 316 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          // @flow
          
          import gensync, { type Handler } from "gensync";
          import {
            maybeAsync,
          Severity: Minor
          Found in packages/babel-core/src/config/caching.js - About 3 hrs to fix

            Function handleNested has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
            Open

            function handleNested(path, t, node, parentExport) {
              const names = new Set();
              const realName = node.id;
              const name = path.scope.generateUid(realName.name);
              const namespaceTopLevel = node.body.body;
            Severity: Minor
            Found in packages/babel-plugin-transform-typescript/src/namespace.js - About 3 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 getTokenFromCode has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
            Open

              getTokenFromCode(code: number): void {
                switch (code) {
                  // The interpretation of a dot depends on whether it is followed
                  // by a digit or another two dots.
            
            
            Severity: Minor
            Found in packages/babel-parser/src/tokenizer/index.js - About 3 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

            Severity
            Category
            Status
            Source
            Language