Showing 1,982 of 1,982 total issues

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

    if (this.state.inParameters) {
      this.raise(node.start, Errors.AwaitExpressionFormalParameter);
    } else if (this.state.awaitPos === -1) {
      this.state.awaitPos = node.start;
    }
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 2292..2296

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

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

    Program(path: NodePath) {
      path.get("body").forEach(bodyPath => {
        if (isPolyfillSource(getRequireSource(bodyPath))) {
          console.warn(NO_DIRECT_POLYFILL_IMPORT);
          bodyPath.remove();
packages/babel-preset-env/src/polyfills/corejs3/usage-plugin.js on lines 116..123

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

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

      enter(path: NodePath) {
        path.get("body").forEach(bodyPath => {
          if (isPolyfillSource(getRequireSource(bodyPath))) {
            console.warn(NO_DIRECT_POLYFILL_IMPORT);
            bodyPath.remove();
packages/babel-preset-env/src/polyfills/corejs2/usage-plugin.js on lines 49..56

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

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

export default function createTemplateBuilder<T>(
  formatter: Formatter<T>,
  defaultOpts?: TemplateOpts,
): TemplateBuilder<T> {
  const templateFnCache = new WeakMap();
Severity: Major
Found in packages/babel-template/src/builder.js - About 2 hrs to fix

    Function removeTypeDuplicates has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function removeTypeDuplicates(
      nodes: Array<Object>,
    ): Array<Object> {
      const generics = {};
      const bases = {};
    Severity: Major
    Found in packages/babel-types/src/modifications/flow/removeTypeDuplicates.js - About 2 hrs to fix

      Function getMarkerLines has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function getMarkerLines(
        loc: NodeLocation,
        source: Array<string>,
        opts: Object,
      ): { start: number, end: number, markerLines: Object } {
      Severity: Major
      Found in packages/babel-code-frame/src/index.js - About 2 hrs to fix

        Function buildResult has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function buildResult(fileResults: Array<Object>): CompilationOutput {
            const map = new sourceMap.SourceMapGenerator({
              file:
                cliOptions.sourceMapTarget ||
                path.basename(cliOptions.outFile || "") ||
        Severity: Major
        Found in packages/babel-cli/src/babel/file.js - About 2 hrs to fix

          Function replaceExpressionWithStatements has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function replaceExpressionWithStatements(nodes: Array<Object>) {
            this.resync();
          
            const toSequenceExpression = t.toSequenceExpression(nodes, this.scope);
          
          
          Severity: Major
          Found in packages/babel-traverse/src/path/replacement.js - About 2 hrs to fix

            Function splitExportDeclaration has 51 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export default function splitExportDeclaration(exportDeclaration) {
              if (!exportDeclaration.isExportDeclaration()) {
                throw new Error("Only export declarations can be splitted.");
              }
            
            
            Severity: Major
            Found in packages/babel-helper-split-export-declaration/src/index.js - About 2 hrs to fix

              Function UnaryExpression has 50 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    UnaryExpression(path) {
                      const { node, parent } = path;
                      if (node.operator !== "typeof") return;
              
                      if (
              Severity: Minor
              Found in packages/babel-plugin-transform-typeof-symbol/src/index.js - About 2 hrs to fix

                Consider simplifying this complex logical expression.
                Open

                    if (
                      // for (MEMBER of ARR)
                      // for (MEMBER in ARR)
                      parentPath.isForXStatement({ left: node }) ||
                      // { KEY: MEMBER } = OBJ
                Severity: Critical
                Found in packages/babel-helper-member-expression-to-functions/src/index.js - About 2 hrs to fix

                  Function getTargets has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export default function getTargets(
                    inputTargets: InputTargets = {},
                    options: Object = {},
                  ): Targets {
                    const targetOpts: Targets = {};
                  Severity: Minor
                  Found in packages/babel-helper-compilation-targets/src/index.js - About 2 hrs to fix

                    Function gatherSequenceExpressions has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export default function gatherSequenceExpressions(
                      nodes: Array<Object>,
                      scope: Scope,
                      declars: Array<Object>,
                    ): ?Object {
                    Severity: Minor
                    Found in packages/babel-types/src/converters/gatherSequenceExpressions.js - About 2 hrs to fix

                      Consider simplifying this complex logical expression.
                      Open

                        if (
                          nodeType === "Literal" ||
                          "StringLiteral" === nodeType ||
                          "NumericLiteral" === nodeType ||
                          "NullLiteral" === nodeType ||
                      Severity: Critical
                      Found in packages/babel-types/src/validators/generated/index.js - About 2 hrs to fix

                        Function ForOfStatement has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                              ForOfStatement(path, state) {
                                const right = path.get("right");
                                if (
                                  right.isArrayExpression() ||
                                  right.isGenericType("Array") ||
                        Severity: Minor
                        Found in packages/babel-plugin-transform-for-of/src/index.js - About 2 hrs to fix

                          Consider simplifying this complex logical expression.
                          Open

                                if (parentPath.isMemberExpression({ object: node })) {
                                  const grandparentPath = parentPath.parentPath;
                          
                                  const argsOptEligible =
                                    !state.deopted &&
                          Severity: Critical
                          Found in packages/babel-plugin-transform-parameters/src/rest.js - About 2 hrs to fix

                            Function ReferencedIdentifier has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              ReferencedIdentifier(path, state) {
                                const { node } = path;
                            
                                // we can't guarantee the purity of arguments
                                if (node.name === "arguments") {
                            Severity: Minor
                            Found in packages/babel-plugin-transform-parameters/src/rest.js - About 2 hrs to fix

                              Function insertAfter has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export function insertAfter(nodes) {
                                this._assertUnremoved();
                              
                                nodes = this._verifyNodeList(nodes);
                              
                              
                              Severity: Minor
                              Found in packages/babel-traverse/src/path/modification.js - About 2 hrs to fix

                                Function MetaProperty has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                      MetaProperty(path) {
                                        const meta = path.get("meta");
                                        const property = path.get("property");
                                        const { scope } = path;
                                
                                
                                Severity: Minor
                                Found in packages/babel-plugin-transform-new-target/src/index.js - About 2 hrs to fix

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

                                  export type EstreeProperty = NodeBase & {
                                    type: "Property",
                                    shorthand: boolean,
                                    key: Expression,
                                    computed: boolean,
                                  Severity: Major
                                  Found in packages/babel-parser/src/types.js and 1 other location - About 2 hrs to fix
                                  packages/babel-parser/src/types.js on lines 1040..1050

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

                                  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