Showing 1,982 of 1,982 total issues

Function parseStatementContent has 116 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  parseStatementContent(context: ?string, topLevel: ?boolean): N.Statement {
    let starttype = this.state.type;
    const node = this.startNode();
    let kind;

Severity: Major
Found in packages/babel-parser/src/parser/statement.js - About 4 hrs to fix

    Function flowParseObjectType has 115 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        flowParseObjectType({
          allowStatic,
          allowExact,
          allowSpread,
          allowProto,
    Severity: Major
    Found in packages/babel-parser/src/plugins/flow.js - About 4 hrs to fix

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

        namespace(name = "namespace") {
          name = this._scope.generateUidIdentifier(name);
      
          const statement = this._statements[this._statements.length - 1];
          assert(statement.type === "ImportDeclaration");
      Severity: Major
      Found in packages/babel-helper-module-imports/src/import-builder.js and 1 other location - About 4 hrs to fix
      packages/babel-helper-module-imports/src/import-builder.js on lines 56..64

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

      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

        default(name) {
          name = this._scope.generateUidIdentifier(name);
          const statement = this._statements[this._statements.length - 1];
          assert(statement.type === "ImportDeclaration");
          assert(statement.specifiers.length === 0);
      Severity: Major
      Found in packages/babel-helper-module-imports/src/import-builder.js and 1 other location - About 4 hrs to fix
      packages/babel-helper-module-imports/src/import-builder.js on lines 46..55

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

      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 getModuleMetadata has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
      Open

      function getModuleMetadata(
        programPath: NodePath,
        { loose, lazy }: { loose: boolean, lazy: boolean },
      ) {
        const localData = getLocalExportMetadata(programPath, loose);

      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 buildHas has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
      Open

        buildHas(ret: string) {
          const body = this.body;
      
          let retCheck;
          const has = this.has;
      Severity: Minor
      Found in packages/babel-plugin-transform-block-scoping/src/index.js - About 4 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

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

            exit(path: NodePath) {
              const filtered = intersection(polyfills, this.polyfillsSet, available);
              const reversed = Array.from(filtered).reverse();
      
              for (const module of reversed) {
      packages/babel-preset-env/src/polyfills/corejs3/entry-plugin.js on lines 94..107

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

      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

            exit(path: NodePath) {
              const filtered = intersection(polyfills, this.polyfillsSet, available);
              const reversed = Array.from(filtered).reverse();
      
              for (const module of reversed) {
      packages/babel-preset-env/src/polyfills/corejs3/usage-plugin.js on lines 125..138

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

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

      export default function parseArgv(args: Array<string>): CmdOptions | null {
        //
        commander.parse(args);
      
        const errors = [];
      Severity: Major
      Found in packages/babel-cli/src/babel/options.js - About 4 hrs to fix

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

        export function isEnumMember(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 3 other locations - About 4 hrs to fix
        packages/babel-types/src/validators/generated/index.js on lines 3719..3738
        packages/babel-types/src/validators/generated/index.js on lines 4223..4242
        packages/babel-types/src/validators/generated/index.js on lines 4467..4486

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

        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 isEnumBody(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 3 other locations - About 4 hrs to fix
        packages/babel-types/src/validators/generated/index.js on lines 3719..3738
        packages/babel-types/src/validators/generated/index.js on lines 4223..4242
        packages/babel-types/src/validators/generated/index.js on lines 4487..4506

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

        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 isCompletionStatement(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 3 other locations - About 4 hrs to fix
        packages/babel-types/src/validators/generated/index.js on lines 4223..4242
        packages/babel-types/src/validators/generated/index.js on lines 4467..4486
        packages/babel-types/src/validators/generated/index.js on lines 4487..4506

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

        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 isModuleDeclaration(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 3 other locations - About 4 hrs to fix
        packages/babel-types/src/validators/generated/index.js on lines 3719..3738
        packages/babel-types/src/validators/generated/index.js on lines 4467..4486
        packages/babel-types/src/validators/generated/index.js on lines 4487..4506

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

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

        module.exports = function (api) {
          const env = api.env();
        
          const includeCoverage = process.env.BABEL_COVERAGE === "true";
        
        
        Severity: Major
        Found in babel.config.js - About 4 hrs to fix

          Function gatherNodeParts has 112 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function gatherNodeParts(node: Object, parts: Array) {
            switch (node?.type) {
              default:
                if (t.isModuleDeclaration(node)) {
                  if (node.source) {
          Severity: Major
          Found in packages/babel-traverse/src/scope/index.js - About 4 hrs to fix

            File normalize-and-load-metadata.js has 351 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import { basename, extname } from "path";
            
            import splitExportDeclaration from "@babel/helper-split-export-declaration";
            
            export type ModuleMetadata = {

              Function ReferencedIdentifier has a Cognitive Complexity of 30 (exceeds 5 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 4 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 handleNested has 110 lines of code (exceeds 25 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: Major
              Found in packages/babel-plugin-transform-typescript/src/namespace.js - About 4 hrs to fix

                Function Class has 110 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      Class(path, state) {
                        if (this.file.get(versionKey) !== version) return;
                
                        verifyUsedFeatures(path, this.file);
                
                
                Severity: Major
                Found in packages/babel-helper-create-class-features-plugin/src/index.js - About 4 hrs to fix

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

                    if (isAccessor) {
                      privateNamesMap.set(prop.node.key.id.name, {
                        ...privateName,
                        initAdded: true,
                      });
                  packages/babel-helper-create-class-features-plugin/src/fields.js on lines 462..477
                  packages/babel-helper-create-class-features-plugin/src/fields.js on lines 487..499

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

                  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