Showing 1,982 of 1,982 total issues

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

          if (node.body.body.length === 0 && path.isCompletionRecord()) {
            node.body.body.unshift(
              t.expressionStatement(scope.buildUndefinedNode()),
            );
          }
packages/babel-plugin-transform-destructuring/src/index.js on lines 501..505

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

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

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

    for (let j = 0; j < this.state.leadingComments.length; j++) {
      if (
        this.state.leadingComments[j].end < this.state.commentPreviousNode.end
      ) {
        this.state.leadingComments.splice(j, 1);
Severity: Major
Found in packages/babel-parser/src/parser/comments.js and 1 other location - About 1 hr to fix
packages/babel-parser/src/parser/comments.js on lines 206..214

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

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

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

          for (j = 0; j < this.state.leadingComments.length; j++) {
            if (
              this.state.leadingComments[j].end <
              this.state.commentPreviousNode.end
            ) {
Severity: Major
Found in packages/babel-parser/src/parser/comments.js and 1 other location - About 1 hr to fix
packages/babel-parser/src/parser/comments.js on lines 67..74

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

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

  forever() {
    if (!this._active) {
      throw new Error("Cannot change caching after evaluation has completed.");
    }
    if (this._never) {
Severity: Major
Found in packages/babel-core/src/config/caching.js and 1 other location - About 1 hr to fix
packages/babel-core/src/config/caching.js on lines 286..295

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

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

  never() {
    if (!this._active) {
      throw new Error("Cannot change caching after evaluation has completed.");
    }
    if (this._forever) {
Severity: Major
Found in packages/babel-core/src/config/caching.js and 1 other location - About 1 hr to fix
packages/babel-core/src/config/caching.js on lines 275..284

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

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 TypeAnnotation(node) {
  this.token(":");
  this.space();
  if (node.optional) this.token("?");
  this.print(node.typeAnnotation, node);
Severity: Major
Found in packages/babel-generator/src/generators/flow.js and 1 other location - About 1 hr to fix
packages/babel-generator/src/generators/typescript.js on lines 1..6

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

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 TSTypeAnnotation(node) {
  this.token(":");
  this.space();
  if (node.optional) this.token("?");
  this.print(node.typeAnnotation, node);
Severity: Major
Found in packages/babel-generator/src/generators/typescript.js and 1 other location - About 1 hr to fix
packages/babel-generator/src/generators/flow.js on lines 421..426

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

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

      CallExpression(path) {
        const { node, scope } = path;

        const args = node.arguments;
        if (!hasSpread(args)) return;
Severity: Minor
Found in packages/babel-plugin-transform-spread/src/index.js - About 1 hr to fix

    Function AssignmentExpression|UpdateExpression has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        "AssignmentExpression|UpdateExpression"(path) {
          if (path.node[IGNORE_REASSIGNMENT_SYMBOL]) return;
          path.node[IGNORE_REASSIGNMENT_SYMBOL] = true;
    
          const arg = path.get(path.isAssignmentExpression() ? "left" : "argument");
    Severity: Minor
    Found in packages/babel-plugin-transform-modules-systemjs/src/index.js - About 1 hr to fix

      Function braceIsBlock has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        braceIsBlock(prevType: TokenType): boolean {
          const parent = this.curContext();
          if (parent === ct.functionExpression || parent === ct.functionStatement) {
            return true;
          }
      Severity: Minor
      Found in packages/babel-parser/src/tokenizer/index.js - About 1 hr to fix

        Function skipSpace has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          skipSpace(): void {
            loop: while (this.state.pos < this.length) {
              const ch = this.input.charCodeAt(this.state.pos);
              switch (ch) {
                case charCodes.space:
        Severity: Minor
        Found in packages/babel-parser/src/tokenizer/index.js - About 1 hr to fix

          Function tryParse has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            tryParse<T: Node | $ReadOnlyArray<Node>>(
              fn: (abort: (node?: T) => empty) => T,
              oldState: State = this.state.clone(),
            ):
              | TryParse<T, null, false, false, null>
          Severity: Minor
          Found in packages/babel-parser/src/parser/util.js - About 1 hr to fix

            Function adjustCommentsAfterTrailingComma has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              adjustCommentsAfterTrailingComma(
                node: Node,
                elements: (Node | null)[],
                // When the current node is followed by a token which hasn't a respective AST node, we
                // need to take all the trailing comments to prevent them from being attached to an
            Severity: Minor
            Found in packages/babel-parser/src/parser/comments.js - About 1 hr to fix

              Function pushBody has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                function pushBody() {
                  const classBodyPaths: Array<Object> = classState.path.get("body.body");
              
                  for (const path of classBodyPaths) {
                    const node = path.node;
              Severity: Minor
              Found in packages/babel-plugin-transform-classes/src/transformClass.js - About 1 hr to fix

                Function pushComputedPropsLoose has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function pushComputedPropsLoose(path, file) {
                  const { node, scope, parent } = path;
                  const { left } = node;
                  let declar, id, intermediate;
                
                

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

                      enter(path, state) {
                        const stop = () => {
                          state.isImmutable = false;
                          path.stop();
                        };

                    Function _resolve has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function _resolve(dangerous?, resolved?): ?NodePath {
                      // detect infinite recursion
                      // todo: possibly have a max length on this just to be safe
                      if (resolved && resolved.indexOf(this) >= 0) return;
                    
                    
                    Severity: Minor
                    Found in packages/babel-traverse/src/path/introspection.js - About 1 hr to fix

                      Function throwVersionError has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function throwVersionError(range, version) {
                        if (typeof range === "number") {
                          if (!Number.isInteger(range)) {
                            throw new Error("Expected string or integer value.");
                          }
                      Severity: Minor
                      Found in packages/babel-helper-plugin-utils/src/index.js - About 1 hr to fix

                        Function checkReservedWord has 40 lines of code (exceeds 25 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 1 hr to fix

                          Function parseSwitchStatement has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            parseSwitchStatement(node: N.SwitchStatement): N.SwitchStatement {
                              this.next();
                              node.discriminant = this.parseHeaderExpression();
                              const cases = (node.cases = []);
                              this.expect(tt.braceL);
                          Severity: Minor
                          Found in packages/babel-parser/src/parser/statement.js - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language