Showing 1,251 of 1,982 total issues

File normalize-options.js has 269 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// @flow
import corejs3Polyfills from "core-js-compat/data";
import findSuggestion from "levenary";
import invariant from "invariant";
import { coerce, SemVer } from "semver";
Severity: Minor
Found in packages/babel-preset-env/src/normalize-options.js - About 2 hrs to fix

    Function constructExportCall has 61 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function constructExportCall(
      path,
      exportIdent,
      exportNames,
      exportValues,
    Severity: Major
    Found in packages/babel-plugin-transform-modules-systemjs/src/index.js - About 2 hrs to fix

      Function parseMaybeUnary has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

        parseMaybeUnary(refExpressionErrors: ?ExpressionErrors): N.Expression {
          if (this.isContextual("await") && this.isAwaitAllowed()) {
            return this.parseAwait();
          } else if (this.state.type.prefix) {
            const node = this.startNode();
      Severity: Minor
      Found in packages/babel-parser/src/parser/expression.js - About 2 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 parseVar has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

        parseVar(
          node: N.VariableDeclaration,
          isFor: boolean,
          kind: "var" | "let" | "const",
        ): N.VariableDeclaration {
      Severity: Minor
      Found in packages/babel-parser/src/parser/statement.js - About 2 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 checkDeclaration has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

        checkDeclaration(node: N.Pattern | N.ObjectProperty): void {
          if (node.type === "Identifier") {
            this.checkDuplicateExports(node, node.name);
          } else if (node.type === "ObjectPattern") {
            for (const prop of node.properties) {
      Severity: Minor
      Found in packages/babel-parser/src/parser/statement.js - About 2 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 finishCallExpression has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

        finishCallExpression<T: N.CallExpression | N.OptionalCallExpression>(
          node: T,
          optional: boolean,
        ): N.Expression {
          if (node.callee.type === "Import") {
      Severity: Minor
      Found in packages/babel-parser/src/parser/expression.js - About 2 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 insertAfter has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

      export function insertAfter(nodes) {
        this._assertUnremoved();
      
        nodes = this._verifyNodeList(nodes);
      
      
      Severity: Minor
      Found in packages/babel-traverse/src/path/modification.js - About 2 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 getConditionalAnnotation has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

      function getConditionalAnnotation(binding, path, name) {
        const ifStatement = getParentConditionalPath(binding, path, name);
        if (!ifStatement) return;
      
        const test = ifStatement.get("test");
      Severity: Minor
      Found in packages/babel-traverse/src/path/inference/inferer-reference.js - About 2 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 BreakStatement|ContinueStatement|ReturnStatement has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

        "BreakStatement|ContinueStatement|ReturnStatement"(path, state) {
          const { node, scope } = path;
          if (node[this.LOOP_IGNORE]) return;
      
          let replace;
      Severity: Minor
      Found in packages/babel-plugin-transform-block-scoping/src/index.js - About 2 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 parentheses.js has 267 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import * as t from "@babel/types";
      
      const PRECEDENCE = {
        "||": 0,
        "??": 0,
      Severity: Minor
      Found in packages/babel-generator/src/node/parentheses.js - About 2 hrs to fix

        Function readTmplToken has 60 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          readTmplToken(): void {
            let out = "",
              chunkStart = this.state.pos,
              containsInvalid = false;
            for (;;) {
        Severity: Major
        Found in packages/babel-parser/src/tokenizer/index.js - About 2 hrs to fix

          Function isExpression has 60 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function isExpression(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 - About 2 hrs to fix

            Function getLetReferences has 60 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              getLetReferences() {
                const block = this.block;
            
                let declarators = [];
            
            
            Severity: Major
            Found in packages/babel-plugin-transform-block-scoping/src/index.js - About 2 hrs to fix

              File analyze-scope.js has 266 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import { types as t } from "@babel/core";
              import escope from "eslint-scope";
              import { Definition } from "eslint-scope/lib/definition";
              import OriginalPatternVisitor from "eslint-scope/lib/pattern-visitor";
              import OriginalReferencer from "eslint-scope/lib/referencer";
              Severity: Minor
              Found in eslint/babel-eslint-parser/src/analyze-scope.js - About 2 hrs to fix

                Function defineType has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export default function defineType(
                  type: string,
                  opts: {
                    fields?: {
                      [string]: FieldOptions,
                Severity: Major
                Found in packages/babel-types/src/definitions/utils.js - About 2 hrs to fix

                  Function replaceWith has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function replaceWith(replacement) {
                    this.resync();
                  
                    if (this.removed) {
                      throw new Error("You can't replace this node, we've already removed it");
                  Severity: Major
                  Found in packages/babel-traverse/src/path/replacement.js - About 2 hrs to fix

                    File configuration.js has 264 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    // @flow
                    
                    import buildDebug from "debug";
                    import path from "path";
                    import json5 from "json5";
                    Severity: Minor
                    Found in packages/babel-core/src/config/files/configuration.js - About 2 hrs to fix

                      UtilParser has 22 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      export default class UtilParser extends Tokenizer {
                        // TODO
                      
                        addExtra(node: Node, key: string, val: any): void {
                          if (!node) return;
                      Severity: Minor
                      Found in packages/babel-parser/src/parser/util.js - About 2 hrs to fix

                        Consider simplifying this complex logical expression.
                        Open

                          if (
                            nodeType === "FlowBaseAnnotation" ||
                            "AnyTypeAnnotation" === nodeType ||
                            "BooleanTypeAnnotation" === nodeType ||
                            "NullLiteralTypeAnnotation" === nodeType ||
                        Severity: Critical
                        Found in packages/babel-types/src/validators/generated/index.js - About 2 hrs to fix

                          Consider simplifying this complex logical expression.
                          Open

                            if (
                              nodeType === "LVal" ||
                              "Identifier" === nodeType ||
                              "MemberExpression" === nodeType ||
                              "RestElement" === nodeType ||
                          Severity: Critical
                          Found in packages/babel-types/src/validators/generated/index.js - About 2 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language