Showing 1,251 of 1,982 total issues

Function completionRecordForSwitch has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

function completionRecordForSwitch(cases, paths) {
  let isLastCaseWithConsequent = true;

  for (let i = cases.length - 1; i >= 0; i--) {
    const switchCase = cases[i];
Severity: Minor
Found in packages/babel-traverse/src/path/family.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 getBindingIdentifierPaths has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

export function getBindingIdentifierPaths(
  duplicates?: boolean = false,
  outerOnly?: boolean = false,
): { [string]: NodePath } {
  const path = this;
Severity: Minor
Found in packages/babel-traverse/src/path/family.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

File estree.js has 366 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// @flow

import { types as tt, TokenType } from "../tokenizer/types";
import type Parser from "../parser";
import type { ExpressionErrors } from "../parser/util";
Severity: Minor
Found in packages/babel-parser/src/plugins/estree.js - About 4 hrs to fix

    Function readTmplToken has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

      readTmplToken(): void {
        let out = "",
          chunkStart = this.state.pos,
          containsInvalid = false;
        for (;;) {
    Severity: Minor
    Found in packages/babel-parser/src/tokenizer/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

    Function getBindingIdentifiers has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function getBindingIdentifiers(
      node: Object,
      duplicates?: boolean,
      outerOnly?: boolean,
    ): { [string]: Object | Array<Object> } {
    Severity: Minor
    Found in packages/babel-types/src/retrievers/getBindingIdentifiers.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

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

    import { declare } from "@babel/helper-plugin-utils";
    import { addDefault, isModule } from "@babel/helper-module-imports";
    import { types as t } from "@babel/core";
    
    import getCoreJS2Definitions from "./runtime-corejs2-definitions";
    Severity: Minor
    Found in packages/babel-plugin-transform-runtime/src/index.js - About 4 hrs to fix

      Function buildRollup has 118 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function buildRollup(packages) {
        const sourcemap = process.env.NODE_ENV === "production";
        const minify = !!process.env.IS_PUBLISH;
        return Promise.all(
          packages.map(
      Severity: Major
      Found in Gulpfile.js - About 4 hrs to fix

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

        import { declare } from "@babel/helper-plugin-utils";
        import syntaxTypeScript from "@babel/plugin-syntax-typescript";
        import { types as t, template } from "@babel/core";
        import { injectInitialization } from "@babel/helper-create-class-features-plugin";
        
        
        Severity: Minor
        Found in packages/babel-plugin-transform-typescript/src/index.js - About 4 hrs to fix

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

                enter(path, state) {
                  if (hasJSX(path)) {
                    const { file } = state;
                    let runtime = RUNTIME_DEFAULT;
          
          
          Severity: Major
          Found in packages/babel-helper-builder-react-jsx-experimental/src/index.js - About 4 hrs to fix

            Consider simplifying this complex logical expression.
            Open

              if (
                nodeType === "Immutable" ||
                "StringLiteral" === nodeType ||
                "NumericLiteral" === nodeType ||
                "NullLiteral" === nodeType ||
            Severity: Critical
            Found in packages/babel-types/src/validators/generated/index.js - About 4 hrs to fix

              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

                  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

                  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

                    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
                            Severity
                            Category
                            Status
                            Source
                            Language