Showing 1,251 of 1,982 total issues

Function hoistFunctionEnvironment has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

function hoistFunctionEnvironment(
  fnPath,
  specCompliant = false,
  allowInsertArrow = true,
) {
Severity: Minor
Found in packages/babel-traverse/src/path/conversion.js - About 3 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

File full.js has 322 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// @flow

import gensync, { type Handler } from "gensync";
import { forwardAsync } from "../gensync-utils/async";

Severity: Minor
Found in packages/babel-core/src/config/full.js - About 3 hrs to fix

    Function standardizeSuperProperty has 92 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function standardizeSuperProperty(superProp) {
      if (
        superProp.parentPath.isAssignmentExpression() &&
        superProp.parentPath.node.operator !== "="
      ) {
    Severity: Major
    Found in packages/babel-traverse/src/path/conversion.js - About 3 hrs to fix

      Consider simplifying this complex logical expression.
      Open

        if (
          nodeType === "TSBaseType" ||
          "TSAnyKeyword" === nodeType ||
          "TSBooleanKeyword" === nodeType ||
          "TSBigIntKeyword" === nodeType ||
      Severity: Critical
      Found in packages/babel-types/src/validators/generated/index.js - About 3 hrs to fix

        File experimental.js has 319 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        // @flow
        import defineType, {
          assertOptionalChainStart,
          assertEach,
          assertNodeType,
        Severity: Minor
        Found in packages/babel-types/src/definitions/experimental.js - About 3 hrs to fix

          Function applyTargetDecorators has 90 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function applyTargetDecorators(path, state, decoratedProps) {
            const name = path.scope.generateDeclaredUidIdentifier(
              path.isClass() ? "class" : "obj",
            );
          
          
          Severity: Major
          Found in packages/babel-plugin-proposal-decorators/src/transformer-legacy.js - About 3 hrs to fix

            File caching.js has 316 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            // @flow
            
            import gensync, { type Handler } from "gensync";
            import {
              maybeAsync,
            Severity: Minor
            Found in packages/babel-core/src/config/caching.js - About 3 hrs to fix

              Function handleNested has a Cognitive Complexity of 25 (exceeds 5 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: Minor
              Found in packages/babel-plugin-transform-typescript/src/namespace.js - About 3 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 getTokenFromCode has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
              Open

                getTokenFromCode(code: number): void {
                  switch (code) {
                    // The interpretation of a dot depends on whether it is followed
                    // by a digit or another two dots.
              
              
              Severity: Minor
              Found in packages/babel-parser/src/tokenizer/index.js - About 3 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 ExportDeclaration has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
              Open

              function ExportDeclaration(node: Object) {
                if (node.declaration) {
                  const declar = node.declaration;
                  this.print(declar, node);
                  if (!t.isStatement(declar)) this.semicolon();
              Severity: Minor
              Found in packages/babel-generator/src/generators/modules.js - About 3 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 verifyConstructor has 86 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                function verifyConstructor() {
                  if (!classState.isDerived) return;
              
                  const path = classState.userConstructorPath;
                  const body = path.get("body");
              Severity: Major
              Found in packages/babel-plugin-transform-classes/src/transformClass.js - About 3 hrs to fix

                Function readEscapedChar has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                Open

                  readEscapedChar(inTemplate: boolean): string | null {
                    const throwOnInvalid = !inTemplate;
                    const ch = this.input.charCodeAt(++this.state.pos);
                    ++this.state.pos;
                    switch (ch) {
                Severity: Minor
                Found in packages/babel-parser/src/tokenizer/index.js - About 3 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 parseMaybeAssign has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                Open

                  parseMaybeAssign(
                    noIn?: ?boolean,
                    refExpressionErrors?: ?ExpressionErrors,
                    afterLeftParse?: Function,
                    refNeedsArrowPos?: ?Pos,
                Severity: Minor
                Found in packages/babel-parser/src/parser/expression.js - About 3 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 validate has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                Open

                  validate(parent, key, node) {
                    if (!process.env.BABEL_TYPES_8_BREAKING) return;
                
                    const match = /\.(\w+)$/.exec(key);
                    if (!match) return;
                Severity: Minor
                Found in packages/babel-types/src/definitions/core.js - About 3 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 parseArgv has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                Open

                export default function parseArgv(args: Array<string>): CmdOptions | null {
                  //
                  commander.parse(args);
                
                  const errors = [];
                Severity: Minor
                Found in packages/babel-cli/src/babel/options.js - About 3 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 getAttachmentPath has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                Open

                  getAttachmentPath() {
                    let path = this._getAttachmentPath();
                    if (!path) return;
                
                    let targetScope = path.scope;
                Severity: Minor
                Found in packages/babel-traverse/src/path/lib/hoister.js - About 3 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 exit has 84 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        exit(path) {
                          if (!isModule(path)) return;
                
                          const browserGlobals = globals || {};
                
                
                Severity: Major
                Found in packages/babel-plugin-transform-modules-umd/src/index.js - About 3 hrs to fix

                  Function flowEnumMembers has 84 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      flowEnumMembers({
                        enumName,
                        explicitType,
                      }: {
                        enumName: string,
                  Severity: Major
                  Found in packages/babel-parser/src/plugins/flow.js - About 3 hrs to fix

                    Consider simplifying this complex logical expression.
                    Open

                      if (
                        nodeType === "FlowDeclaration" ||
                        "DeclareClass" === nodeType ||
                        "DeclareFunction" === nodeType ||
                        "DeclareInterface" === nodeType ||
                    Severity: Critical
                    Found in packages/babel-types/src/validators/generated/index.js - About 3 hrs to fix

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

                      //@flow
                      
                      import { SemVer } from "semver";
                      import { logPluginOrPolyfill } from "./debug";
                      import getOptionSpecificExcludesFor from "./get-option-specific-excludes";
                      Severity: Minor
                      Found in packages/babel-preset-env/src/index.js - About 3 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language