packages/babel-plugin-transform-runtime/src/index.js

Summary

Maintainability
D
2 days
Test Coverage

File index.js has 364 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { declare } from "@babel/helper-plugin-utils";
import { addDefault, isModule } from "@babel/helper-module-imports";
import { types as t } from "@babel/core";

import getCoreJS2Definitions from "./runtime-corejs2-definitions";
Severity: Minor
Found in packages/babel-plugin-transform-runtime/src/index.js - About 4 hrs to fix

    Function CallExpression has 54 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          CallExpression(path) {
            if (!injectCoreJS) return;
    
            const { node } = path;
            const { callee } = node;
    Severity: Major
    Found in packages/babel-plugin-transform-runtime/src/index.js - About 2 hrs to fix

      Function enter has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              enter(path) {
                if (!injectCoreJS) return;
                if (!path.isReferenced()) return;
                // skip transforming `delete something.includes`
                if (path.parentPath.isUnaryExpression({ operator: "delete" })) return;
      Severity: Major
      Found in packages/babel-plugin-transform-runtime/src/index.js - About 2 hrs to fix

        Function pre has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            pre(file) {
              if (useRuntimeHelpers) {
                file.set("helperGenerator", name => {
                  // If the helper didn't exist yet at the version given, we bail
                  // out and let Babel either insert it directly, or throw an error
        Severity: Minor
        Found in packages/babel-plugin-transform-runtime/src/index.js - About 1 hr to fix

          Avoid too many return statements within this function.
          Open

                    return;
          Severity: Major
          Found in packages/babel-plugin-transform-runtime/src/index.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return;
            Severity: Major
            Found in packages/babel-plugin-transform-runtime/src/index.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return;
              Severity: Major
              Found in packages/babel-plugin-transform-runtime/src/index.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        if (!callee.computed) return;
                Severity: Major
                Found in packages/babel-plugin-transform-runtime/src/index.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          if (scope.getBindingIdentifier(name)) return;
                  Severity: Major
                  Found in packages/babel-plugin-transform-runtime/src/index.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                              if (path.scope.getBindingIdentifier(name)) return;
                    Severity: Major
                    Found in packages/babel-plugin-transform-runtime/src/index.js - About 30 mins to fix

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

                        if (typeof corejs === "object" && corejs !== null) {
                          rawVersion = corejs.version;
                          proposals = Boolean(corejs.proposals);
                        } else {
                          rawVersion = corejs;
                      Severity: Major
                      Found in packages/babel-plugin-transform-runtime/src/index.js and 1 other location - About 1 hr to fix
                      packages/babel-preset-env/src/normalize-options.js on lines 235..240

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

                      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

                                      t.callExpression(
                                        this.addDefaultImport(
                                          `${moduleName}/${corejsRoot}/instance/${InstanceProperties[propertyName].path}`,
                                          `${propertyName}InstanceProperty`,
                                        ),
                      Severity: Major
                      Found in packages/babel-plugin-transform-runtime/src/index.js and 1 other location - About 1 hr to fix
                      packages/babel-plugin-transform-runtime/src/index.js on lines 307..313

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

                      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

                                    t.callExpression(
                                      this.addDefaultImport(
                                        `${moduleName}/${corejsRoot}/instance/${InstanceProperties[propertyName].path}`,
                                        `${propertyName}InstanceProperty`,
                                      ),
                      Severity: Major
                      Found in packages/babel-plugin-transform-runtime/src/index.js and 1 other location - About 1 hr to fix
                      packages/babel-plugin-transform-runtime/src/index.js on lines 404..410

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

                      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

                      There are no issues that match your filters.

                      Category
                      Status