Showing 1,251 of 1,982 total issues

Function Class has 110 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      Class(path, state) {
        if (this.file.get(versionKey) !== version) return;

        verifyUsedFeatures(path, this.file);

Severity: Major
Found in packages/babel-helper-create-class-features-plugin/src/index.js - About 4 hrs to fix

    Function exports has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

    module.exports = function () {
      return {
        name: "babel-source",
        load(id) {
          const matches = id.match(/packages\/(babel-[^/]+)\/src\//);
    Severity: Minor
    Found in scripts/rollup-plugin-babel-source.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 parseSubscript has 106 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      parseSubscript(
        base: N.Expression,
        startPos: number,
        startLoc: Position,
        noCalls: ?boolean,
    Severity: Major
    Found in packages/babel-parser/src/parser/expression.js - About 4 hrs to fix

      Function parseParenAndDistinguishExpression has 104 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        parseParenAndDistinguishExpression(canBeArrow: boolean): N.Expression {
          const startPos = this.state.start;
          const startLoc = this.state.startLoc;
      
          let val;
      Severity: Major
      Found in packages/babel-parser/src/parser/expression.js - About 4 hrs to fix

        File corejs2-built-in-features.js has 338 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        const typedArrayMethods = [
          "typed arrays / %TypedArray%.from",
          "typed arrays / %TypedArray%.of",
          "typed arrays / %TypedArray%.prototype.subarray",
          "typed arrays / %TypedArray%.prototype.join",
        Severity: Minor
        Found in packages/babel-compat-data/scripts/data/corejs2-built-in-features.js - About 4 hrs to fix

          Function readNumber has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

            readNumber(startsWithDot: boolean): void {
              const start = this.state.pos;
              let isFloat = false;
              let isBigInt = false;
              let isNonOctalDecimalInt = false;
          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 parseParenAndDistinguishExpression has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

            parseParenAndDistinguishExpression(canBeArrow: boolean): N.Expression {
              const startPos = this.state.start;
              const startLoc = this.state.startLoc;
          
              let val;
          Severity: Minor
          Found in packages/babel-parser/src/parser/expression.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 placeholderVisitorHandler has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

          function placeholderVisitorHandler(
            node: BabelNode,
            ancestors: TraversalAncestors,
            state: MetadataState,
          ) {
          Severity: Minor
          Found in packages/babel-template/src/parse.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 introspection.js has 336 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          // This file contains methods responsible for introspecting the current path for certain values.
          
          import type NodePath from "./index";
          import includes from "lodash/includes";
          import * as t from "@babel/types";
          Severity: Minor
          Found in packages/babel-traverse/src/path/introspection.js - About 4 hrs to fix

            Consider simplifying this complex logical expression.
            Open

              if (
                nodeType === "JSX" ||
                "JSXAttribute" === nodeType ||
                "JSXClosingElement" === nodeType ||
                "JSXElement" === nodeType ||
            Severity: Critical
            Found in packages/babel-types/src/validators/generated/index.js - About 4 hrs to fix

              File option-assertions.js has 333 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              // @flow
              
              import type {
                ConfigFileSearch,
                BabelrcSearch,
              Severity: Minor
              Found in packages/babel-core/src/config/validation/option-assertions.js - About 4 hrs to fix

                Function wrapClosure has 98 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  wrapClosure() {
                    if (this.throwIfClosureRequired) {
                      throw this.blockPath.buildCodeFrameError(
                        "Compiling let/const in this block would add a closure " +
                          "(throwIfClosureRequired).",
                Severity: Major
                Found in packages/babel-plugin-transform-block-scoping/src/index.js - About 3 hrs to fix

                  Function getPolyfillPlugins has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export const getPolyfillPlugins = ({
                    useBuiltIns,
                    corejs,
                    polyfillTargets,
                    include,
                  Severity: Minor
                  Found in packages/babel-preset-env/src/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

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

                  /* eslint-env jest */
                  import * as babel from "@babel/core";
                  import { buildExternalHelpers } from "@babel/core";
                  import getFixtures from "@babel/helper-fixtures";
                  import sourceMap from "source-map";
                  Severity: Minor
                  Found in packages/babel-helper-transform-fixture-test-runner/src/index.js - About 3 hrs to fix

                    Function checkLVal has 96 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      checkLVal(
                        expr: Expression,
                        bindingType: BindingTypes = BIND_NONE,
                        checkClashes: ?{ [key: string]: boolean },
                        contextDescription: string,
                    Severity: Major
                    Found in packages/babel-parser/src/parser/lval.js - About 3 hrs to fix

                      File evaluation.js has 326 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import type NodePath from "./index";
                      
                      // This file contains Babels metainterpreter that can evaluate static code.
                      
                      const VALID_CALLEES = ["String", "Number", "Math"];
                      Severity: Minor
                      Found in packages/babel-traverse/src/path/evaluation.js - About 3 hrs to fix

                        Function getHelperMetadata has 94 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function getHelperMetadata(file) {
                          const globals = new Set();
                          const localBindingNames = new Set();
                          // Maps imported identifier -> helper name
                          const dependencies = new Map();
                        Severity: Major
                        Found in packages/babel-helpers/src/index.js - About 3 hrs to fix

                          Function getLocalExportMetadata has 94 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function getLocalExportMetadata(
                            programPath: NodePath,
                            loose: boolean,
                          ): Map<string, LocalExportMetadata> {
                            const bindingKindLookup = new Map();

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

                            export default function valueToNode(value: any): Object {
                              // undefined
                              if (value === undefined) {
                                return identifier("undefined");
                              }
                            Severity: Minor
                            Found in packages/babel-types/src/converters/valueToNode.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 defineType has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export default function defineType(
                              type: string,
                              opts: {
                                fields?: {
                                  [string]: FieldOptions,
                            Severity: Minor
                            Found in packages/babel-types/src/definitions/utils.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

                            Severity
                            Category
                            Status
                            Source
                            Language