Showing 1,251 of 1,982 total issues

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

      Function pushTask has 139 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function pushTask(taskName, taskDir, suite, suiteName) {
        const taskDirStats = fs.statSync(taskDir);
        let actualLoc = findFile(taskDir + "/input");
        let execLoc = findFile(taskDir + "/exec");
      
      
      Severity: Major
      Found in packages/babel-helper-fixtures/src/index.js - About 5 hrs to fix

        Function checkExport has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
        Open

          checkExport(
            node: N.ExportNamedDeclaration,
            checkNames?: boolean,
            isDefault?: boolean,
            isFrom?: boolean,
        Severity: Minor
        Found in packages/babel-parser/src/parser/statement.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 lval.js has 390 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        // @flow
        
        import * as charCodes from "charcodes";
        import { types as tt, type TokenType } from "../tokenizer/types";
        import type {
        Severity: Minor
        Found in packages/babel-parser/src/parser/lval.js - About 5 hrs to fix

          Function processComment has 133 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            processComment(node: Node): void {
              if (node.type === "Program" && node.body.length > 0) return;
          
              const stack = this.state.commentStack;
          
          
          Severity: Major
          Found in packages/babel-parser/src/parser/comments.js - About 5 hrs to fix

            Function parseSubscript has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
            Open

              parseSubscript(
                base: N.Expression,
                startPos: number,
                startLoc: Position,
                noCalls: ?boolean,
            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

            Function cloneNode has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
            Open

            export default function cloneNode<T: Object>(
              node: T,
              deep: boolean = true,
              withoutLoc: boolean = false,
            ): T {
            Severity: Minor
            Found in packages/babel-types/src/clone/cloneNode.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 buildFieldsInitNodes has 130 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function buildFieldsInitNodes(
              ref,
              superRef,
              props,
              privateNamesMap,
            Severity: Major
            Found in packages/babel-helper-create-class-features-plugin/src/fields.js - About 5 hrs to fix

              Function convertFunctionParams has 129 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export default function convertFunctionParams(
                path,
                loose,
                shouldTransformParam,
                replaceRestElement,
              Severity: Major
              Found in packages/babel-plugin-transform-parameters/src/params.js - About 5 hrs to fix

                Function parseClassMemberWithIsStatic has 126 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  parseClassMemberWithIsStatic(
                    classBody: N.ClassBody,
                    member: N.ClassMember,
                    state: { hadConstructor: boolean },
                    isStatic: boolean,
                Severity: Major
                Found in packages/babel-parser/src/parser/statement.js - About 5 hrs to fix

                  Function hoistFunctionEnvironment has 126 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function hoistFunctionEnvironment(
                    fnPath,
                    specCompliant = false,
                    allowInsertArrow = true,
                  ) {
                  Severity: Major
                  Found in packages/babel-traverse/src/path/conversion.js - About 5 hrs to fix

                    Function run has 125 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function run(task) {
                      const {
                        actual,
                        expect: expected,
                        exec,
                    Severity: Major
                    Found in packages/babel-helper-transform-fixture-test-runner/src/index.js - About 5 hrs to fix

                      Consider simplifying this complex logical expression.
                      Open

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

                        Function loadFullConfig has 124 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export default gensync<[any], ResolvedConfig | null>(function* loadFullConfig(
                          inputOpts: mixed,
                        ): Handler<ResolvedConfig | null> {
                          const result = yield* loadPrivatePartialConfig(inputOpts);
                          if (!result) {
                        Severity: Major
                        Found in packages/babel-core/src/config/full.js - About 4 hrs to fix

                          Function OptionalCallExpression|OptionalMemberExpression has 123 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                "OptionalCallExpression|OptionalMemberExpression"(path) {
                                  const { scope } = path;
                                  // maybeParenthesized points to the outermost parenthesizedExpression
                                  // or the path itself
                                  let maybeParenthesized = path;
                          Severity: Major
                          Found in packages/babel-plugin-proposal-optional-chaining/src/index.js - About 4 hrs to fix

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

                            export default function removeTypeDuplicates(
                              nodes: Array<Object>,
                            ): Array<Object> {
                              const generics = {};
                              const bases = {};
                            Severity: Minor
                            Found in packages/babel-types/src/modifications/flow/removeTypeDuplicates.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 default has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export default function (
                              _: any,
                              { corejs, include, exclude, polyfillTargets, debug }: InternalPluginOptions,
                            ) {
                              const polyfills = filterItems(
                            Severity: Minor
                            Found in packages/babel-preset-env/src/polyfills/corejs3/entry-plugin.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

                            Severity
                            Category
                            Status
                            Source
                            Language