Showing 1,982 of 1,982 total issues

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

export function NumberLiteral(...args: Array<any>): Object {
  console.trace(
    "The node type NumberLiteral has been renamed to NumericLiteral",
  );
  return NumberLiteral("NumberLiteral", ...args);
Severity: Major
Found in packages/babel-types/src/builders/generated/index.js and 3 other locations - About 50 mins to fix
packages/babel-types/src/builders/generated/index.js on lines 1043..1046
packages/babel-types/src/builders/generated/index.js on lines 1048..1051
packages/babel-types/src/builders/generated/index.js on lines 1053..1058

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

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

defineType("EnumNumberBody", {
  aliases: ["EnumBody"],
  visitor: ["members"],
  fields: {
    explicit: validate(assertValueType("boolean")),
Severity: Major
Found in packages/babel-types/src/definitions/flow.js and 2 other locations - About 50 mins to fix
packages/babel-types/src/definitions/flow.js on lines 488..495
packages/babel-types/src/definitions/typescript.js on lines 273..280

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

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

export function RestProperty(...args: Array<any>): Object {
  console.trace("The node type RestProperty has been renamed to RestElement");
  return RestProperty("RestProperty", ...args);
}
Severity: Major
Found in packages/babel-types/src/builders/generated/index.js and 3 other locations - About 50 mins to fix
packages/babel-types/src/builders/generated/index.js on lines 1036..1041
packages/babel-types/src/builders/generated/index.js on lines 1043..1046
packages/babel-types/src/builders/generated/index.js on lines 1053..1058

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

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 (next === charCodes.equalsTo) {
      this.finishOp(tt.assign, 2);
    } else {
      this.finishOp(tt.slash, 1);
    }
Severity: Major
Found in packages/babel-parser/src/tokenizer/index.js and 2 other locations - About 50 mins to fix
packages/babel-parser/src/tokenizer/index.js on lines 590..594
packages/babel-parser/src/tokenizer/index.js on lines 621..625

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

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

type TransformFile = {
  (filename: string, callback: FileResultCallback): void,
  (filename: string, opts: ?InputOptions, callback: FileResultCallback): void,
};
Severity: Minor
Found in packages/babel-core/src/transform-file.js and 1 other location - About 50 mins to fix
packages/babel-core/src/transform-file-browser.js on lines 4..7

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

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

Avoid deeply nested control flow statements.
Open

        if (node.id.type === "Identifier") {
          this._checkIdentifierOrVisit(node.id);
        } else {
          this._visitTypeAnnotation(node.id);
        }
Severity: Major
Found in eslint/babel-eslint-parser/src/analyze-scope.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                  if (browserFile === false) {
                    return "";
                  }
    Severity: Major
    Found in scripts/rollup-plugin-babel-source.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                      if (id) {
                        exportNames.push("default");
                        exportValues.push(undefinedIdent);
                        variableIds.push(id);
                        addExportName(id.name, "default");
      Severity: Major
      Found in packages/babel-plugin-transform-modules-systemjs/src/index.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                      if (declar.node) {
                        path.replaceWith(declar);
        
                        if (path.isFunction()) {
                          const node = declar.node;
        Severity: Major
        Found in packages/babel-plugin-transform-modules-systemjs/src/index.js - About 45 mins to fix

          Function dynamicImportUrlToPath has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          function dynamicImportUrlToPath({ template }) {
            const currentNodeSupportsURL = !!require("url").pathToFileURL;
          
            if (currentNodeSupportsURL) {
              return {
          Severity: Minor
          Found in babel.config.js - About 45 mins 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

          Avoid deeply nested control flow statements.
          Open

                            for (const importPath of importsToRemove) {
                              importPath.remove();
                            }
          Severity: Major
          Found in packages/babel-plugin-transform-typescript/src/index.js - About 45 mins to fix

            Function get has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            export default function get(entryLoc): Array<Suite> {
              const suites = [];
            
              let rootOpts = {};
              const rootOptsLoc = tryResolve(entryLoc + "/options");
            Severity: Minor
            Found in packages/babel-helper-fixtures/src/index.js - About 45 mins 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

            Avoid deeply nested control flow statements.
            Open

                      if (startingOptional.node.optional) break;
            Severity: Major
            Found in packages/babel-helper-member-expression-to-functions/src/index.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                              if (result && typeof result.then === "function") {
                                return result;
                              }
              Severity: Major
              Found in packages/babel-helper-transform-fixture-test-runner/src/index.js - About 45 mins to fix

                Function readdirRecursive has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                async function* readdirRecursive(root, dir = ".") {
                  const names = await fs.readdir(path.join(root, dir));
                
                  const dirs = [];
                
                
                Severity: Minor
                Found in scripts/parser-tests/flow/index.js - About 45 mins 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

                Avoid deeply nested control flow statements.
                Open

                            for (let k = 0; k < propertyType.values.length; k++) {
                              const loopPropertyNode = nodeProperty[j][propertyType.values[k]];
                              if (loopPropertyNode) {
                                this._checkIdentifierOrVisit(loopPropertyNode);
                              }
                Severity: Major
                Found in eslint/babel-eslint-parser/src/analyze-scope.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                    if (
                                      binding &&
                                      isImportTypeOnly({
                                        binding,
                                        programPath: path,
                  Severity: Major
                  Found in packages/babel-plugin-transform-typescript/src/index.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                  } else if (declar.isFunctionDeclaration()) {
                                    if (id) {
                                      beforeBody.push(declar.node);
                                      exportNames.push("default");
                                      exportValues.push(t.cloneNode(id));
                    Severity: Major
                    Found in packages/babel-plugin-transform-modules-systemjs/src/index.js - About 45 mins to fix

                      Function readToken_lt_gt has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                        readToken_lt_gt(code: number): void {
                          // '<>'
                          const next = this.input.charCodeAt(this.state.pos + 1);
                          let size = 1;
                      
                      
                      Severity: Minor
                      Found in packages/babel-parser/src/tokenizer/index.js - About 45 mins 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

                      Avoid deeply nested control flow statements.
                      Open

                                  if (
                                    lookahead.type === tt.name ||
                                    lookahead.type === tt.string ||
                                    lookahead.type === tt.num
                                  ) {
                      Severity: Major
                      Found in packages/babel-parser/src/plugins/flow.js - About 45 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language