Showing 1,982 of 1,982 total issues

Function _generateImport has 162 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  _generateImport(opts, importName) {
    const isDefault = importName === "default";
    const isNamed = !!importName && !isDefault;
    const isNamespace = importName === null;

Severity: Major
Found in packages/babel-helper-module-imports/src/import-injector.js - About 6 hrs to fix

    Function gatherSequenceExpressions has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function gatherSequenceExpressions(
      nodes: Array<Object>,
      scope: Scope,
      declars: Array<Object>,
    ): ?Object {
    Severity: Minor
    Found in packages/babel-types/src/converters/gatherSequenceExpressions.js - About 6 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 _resolve has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
    Open

    export function _resolve(dangerous?, resolved?): ?NodePath {
      // detect infinite recursion
      // todo: possibly have a max length on this just to be safe
      if (resolved && resolved.indexOf(this) >= 0) return;
    
    
    Severity: Minor
    Found in packages/babel-traverse/src/path/introspection.js - About 6 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 explode has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
    Open

    export function explode(visitor) {
      if (visitor._exploded) return visitor;
      visitor._exploded = true;
    
      // normalise pipes
    Severity: Minor
    Found in packages/babel-traverse/src/visitors.js - About 6 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 flowParsePrimaryType has 160 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        flowParsePrimaryType(): N.FlowTypeAnnotation {
          const startPos = this.state.start;
          const startLoc = this.state.startLoc;
          const node = this.startNode();
          let tmp;
    Severity: Major
    Found in packages/babel-parser/src/plugins/flow.js - About 6 hrs to fix

      File printer.js has 430 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import isInteger from "lodash/isInteger";
      import repeat from "lodash/repeat";
      import Buffer from "./buffer";
      import * as n from "./node";
      import * as t from "@babel/types";
      Severity: Minor
      Found in packages/babel-generator/src/printer.js - About 6 hrs to fix

        Function _visitTypeAnnotation has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
        Open

          _visitTypeAnnotation(node) {
            if (!node) {
              return;
            }
            if (Array.isArray(node)) {
        Severity: Minor
        Found in eslint/babel-eslint-parser/src/analyze-scope.js - About 6 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 readInt has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
        Open

          readInt(
            radix: number,
            len?: number,
            forceLen?: boolean,
            allowNumSeparator: boolean = true,
        Severity: Minor
        Found in packages/babel-parser/src/tokenizer/index.js - About 6 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 gatherNodeParts has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
        Open

        function gatherNodeParts(node: Object, parts: Array) {
          switch (node?.type) {
            default:
              if (t.isModuleDeclaration(node)) {
                if (node.source) {
        Severity: Minor
        Found in packages/babel-traverse/src/scope/index.js - About 6 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

        Tokenizer has 45 functions (exceeds 20 allowed). Consider refactoring.
        Open

        export default class Tokenizer extends ParserErrors {
          // Forward-declarations
          // parser/util.js
          /*::
          +unexpected: (pos?: ?number, messageOrType?: string | TokenType) => empty;
        Severity: Minor
        Found in packages/babel-parser/src/tokenizer/index.js - About 6 hrs to fix

          Function parseClassMemberWithIsStatic has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
          Open

            parseClassMemberWithIsStatic(
              classBody: N.ClassBody,
              member: N.ClassMember,
              state: { hadConstructor: boolean },
              isStatic: boolean,
          Severity: Minor
          Found in packages/babel-parser/src/parser/statement.js - About 6 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 checkLVal has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
          Open

            checkLVal(
              expr: Expression,
              bindingType: BindingTypes = BIND_NONE,
              checkClashes: ?{ [key: string]: boolean },
              contextDescription: string,
          Severity: Minor
          Found in packages/babel-parser/src/parser/lval.js - About 6 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 isNodesEquivalent has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
          Open

          export default function isNodesEquivalent(a: any, b: any): boolean {
            if (
              typeof a !== "object" ||
              typeof b !== "object" ||
              a == null ||
          Severity: Minor
          Found in packages/babel-types/src/validators/isNodesEquivalent.js - About 5 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 built-in-definitions.js has 413 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          // @flow
          
          type ObjectMap<V> = { [name: string]: V };
          
          const ArrayNatureIterators = [

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

            export default async function ({
              cliOptions,
              babelOptions,
            }: CmdOptions): Promise<void> {
              function buildResult(fileResults: Array<Object>): CompilationOutput {
            Severity: Minor
            Found in packages/babel-cli/src/babel/file.js - About 5 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

            Consider simplifying this complex logical expression.
            Open

              if (
                nodeType === "Scopable" ||
                "BlockStatement" === nodeType ||
                "CatchClause" === nodeType ||
                "DoWhileStatement" === nodeType ||
            Severity: Critical
            Found in packages/babel-types/src/validators/generated/index.js - About 5 hrs to fix

              Printer has 42 functions (exceeds 20 allowed). Consider refactoring.
              Open

              export default class Printer {
                constructor(format, map) {
                  this.format = format || {};
                  this._buf = new Buffer(map);
                }
              Severity: Minor
              Found in packages/babel-generator/src/printer.js - About 5 hrs to fix

                Function convertNodes has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                Open

                function convertNodes(ast, code) {
                  const astTransformVisitor = {
                    noScope: true,
                    enter(path) {
                      const { node } = path;
                Severity: Minor
                Found in eslint/babel-eslint-parser/src/convert/convertAST.js - About 5 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 parseExprOp has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                Open

                  parseExprOp(
                    left: N.Expression,
                    leftStartPos: number,
                    leftStartLoc: Position,
                    minPrec: number,
                Severity: Minor
                Found in packages/babel-parser/src/parser/expression.js - About 5 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 options.js has 399 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                // @flow
                
                import type { ConfigItem } from "../item";
                import Plugin from "../plugin";
                
                
                Severity: Minor
                Found in packages/babel-core/src/config/validation/options.js - About 5 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language