Showing 1,982 of 1,982 total issues

Consider simplifying this complex logical expression.
Open

  if (
    nodeType === "Statement" ||
    "BlockStatement" === nodeType ||
    "BreakStatement" === nodeType ||
    "ContinueStatement" === nodeType ||
Severity: Critical
Found in packages/babel-types/src/validators/generated/index.js - About 2 days to fix

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

    import includes from "lodash/includes";
    import repeat from "lodash/repeat";
    import Renamer from "./lib/renamer";
    import type NodePath from "../path";
    import traverse from "../index";
    Severity: Major
    Found in packages/babel-traverse/src/scope/index.js - About 1 day to fix

      Consider simplifying this complex logical expression.
      Open

        if (
          nodeType === "Expression" ||
          "ArrayExpression" === nodeType ||
          "AssignmentExpression" === nodeType ||
          "BinaryExpression" === nodeType ||
      Severity: Critical
      Found in packages/babel-types/src/validators/generated/index.js - About 1 day to fix

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

            BuiltIns: {
              AggregateError: { stable: false, path: "aggregate-error" },
              Map: { stable: true, path: "map" },
              Observable: { stable: false, path: "observable" },
              Promise: { stable: true, path: "promise" },
        packages/babel-plugin-transform-runtime/src/runtime-corejs2-definitions.js on lines 33..66

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

        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

              Object: {
                assign: { stable: true, path: "object/assign" },
                create: { stable: true, path: "object/create" },
                defineProperties: { stable: true, path: "object/define-properties" },
                defineProperty: { stable: true, path: "object/define-property" },
        packages/babel-plugin-transform-runtime/src/runtime-corejs3-definitions.js on lines 3..24

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

        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 default declare((api, options) => {
          const PURE_ANNOTATION = options.pure;
        
          const visitor = helper(api, {
            pre(state) {
        packages/babel-plugin-transform-react-jsx-development/src/index.js on lines 6..52

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

        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 default declare((api, options) => {
          const PURE_ANNOTATION = options.pure;
        
          const visitor = helper(api, {
            pre(state) {
        packages/babel-plugin-transform-react-jsx/src/transform-automatic.js on lines 6..52

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

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

        export default function (
          _: any,
          {
            corejs,
            include,
        Severity: Minor
        Found in packages/babel-preset-env/src/polyfills/corejs3/usage-plugin.js - About 1 day 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 default has a Cognitive Complexity of 84 (exceeds 5 allowed). Consider refactoring.
        Open

        export default function (
          { types: t }: { types: Object },
          { include, exclude, polyfillTargets, debug }: InternalPluginOptions,
        ) {
          const polyfills = filterItems(
        Severity: Minor
        Found in packages/babel-preset-env/src/polyfills/corejs2/usage-plugin.js - About 1 day 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

        StatementParser has 86 functions (exceeds 20 allowed). Consider refactoring.
        Open

        export default class StatementParser extends ExpressionParser {
          // ### Statement parsing
        
          // Parse a program. Initializes the parser, reads any number of
          // statements, and wraps them in a Program node.  Optionally takes a
        Severity: Major
        Found in packages/babel-parser/src/parser/statement.js - About 1 day to fix

          Function default has a Cognitive Complexity of 81 (exceeds 5 allowed). Consider refactoring.
          Open

          export default function (opts) {
            const visitor = {};
          
            visitor.JSXNamespacedName = function (path) {
              if (opts.throwIfNamespace) {
          Severity: Minor
          Found in packages/babel-helper-builder-react-jsx/src/index.js - About 1 day 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

          File es2015.js has 694 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          // @flow
          import defineType, {
            assertShape,
            assertNodeType,
            assertValueType,
          Severity: Major
          Found in packages/babel-types/src/definitions/es2015.js - About 1 day to fix

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

            import { declare } from "@babel/helper-plugin-utils";
            import type NodePath from "@babel/traverse";
            import type Scope from "@babel/traverse";
            import { visitor as tdzVisitor } from "./tdz";
            import values from "lodash/values";
            Severity: Major
            Found in packages/babel-plugin-transform-block-scoping/src/index.js - About 1 day to fix

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

              import * as t from "@babel/types";
              import { addNamed, addNamespace, isModule } from "@babel/helper-module-imports";
              import annotateAsPure from "@babel/helper-annotate-as-pure";
              
              const DEFAULT = {
              Severity: Major
              Found in packages/babel-helper-builder-react-jsx-experimental/src/index.js - About 1 day to fix

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

                      Symbol: {
                        asyncIterator: { stable: true, path: "symbol/async-iterator" },
                        dispose: { stable: false, path: "symbol/dispose" },
                        for: { stable: true, path: "symbol/for" },
                        hasInstance: { stable: true, path: "symbol/has-instance" },
                packages/babel-plugin-transform-runtime/src/runtime-corejs2-definitions.js on lines 70..88

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

                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

                            Math: {
                              acosh: { stable: true, path: "math/acosh" },
                              asinh: { stable: true, path: "math/asinh" },
                              atanh: { stable: true, path: "math/atanh" },
                              cbrt: { stable: true, path: "math/cbrt" },
                packages/babel-plugin-transform-runtime/src/runtime-corejs3-definitions.js on lines 159..180

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

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

                  handle(member) {
                    const { node, parent, parentPath } = member;
                
                    if (member.isOptionalMemberExpression()) {
                      // Transforming optional chaining requires we replace ancestors.
                Severity: Minor
                Found in packages/babel-helper-member-expression-to-functions/src/index.js - About 1 day 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 createClassFeaturePlugin has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring.
                Open

                export function createClassFeaturePlugin({
                  name,
                  feature,
                  loose,
                  manipulateOptions,
                Severity: Minor
                Found in packages/babel-helper-create-class-features-plugin/src/index.js - About 1 day 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 exit has 300 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        exit(path, state) {
                          const undefinedIdent = path.scope.buildUndefinedNode();
                          const exportIdent = path.scope.generateUid("export");
                          const contextIdent = state.contextIdent;
                
                
                Severity: Major
                Found in packages/babel-plugin-transform-modules-systemjs/src/index.js - About 1 day to fix

                  File fields.js has 662 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import { template, traverse, types as t } from "@babel/core";
                  import ReplaceSupers, {
                    environmentVisitor,
                  } from "@babel/helper-replace-supers";
                  import memberExpressionToFunctions from "@babel/helper-member-expression-to-functions";
                  Severity: Major
                  Found in packages/babel-helper-create-class-features-plugin/src/fields.js - About 1 day to fix
                    Severity
                    Category
                    Status
                    Source
                    Language