Showing 1,251 of 1,982 total issues

Function readInt has 69 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  readInt(
    radix: number,
    len?: number,
    forceLen?: boolean,
    allowNumSeparator: boolean = true,
Severity: Major
Found in packages/babel-parser/src/tokenizer/index.js - About 2 hrs to fix

    Function getReferenceOrigin has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function getReferenceOrigin(
      node,
      scope,
    ) /*: ?ReferenceOrigin */ {
      if (node.type === "Identifier") {

    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 adjustCommentsAfterTrailingComma has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

      adjustCommentsAfterTrailingComma(
        node: Node,
        elements: (Node | null)[],
        // When the current node is followed by a token which hasn't a respective AST node, we
        // need to take all the trailing comments to prevent them from being attached to an
    Severity: Minor
    Found in packages/babel-parser/src/parser/comments.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 codeFrameColumns has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

    export function codeFrameColumns(
      rawLines: string,
      loc: NodeLocation,
      opts: Object = {},
    ): string {
    Severity: Minor
    Found in packages/babel-code-frame/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

    Function enableFeature has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

    export function enableFeature(file, feature, loose) {
      // We can't blindly enable the feature because, if it was already set,
      // "loose" can't be changed, so that
      //   @babel/plugin-class-properties { loose: true }
      //   @babel/plugin-class-properties { loose: false }
    Severity: Minor
    Found in packages/babel-helper-create-class-features-plugin/src/features.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 getMarkerLines has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

    function getMarkerLines(
      loc: NodeLocation,
      source: Array<string>,
      opts: Object,
    ): { start: number, end: number, markerLines: Object } {
    Severity: Minor
    Found in packages/babel-code-frame/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

    Function generateCode has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function generateCode(
      pluginPasses: PluginPasses,
      file: File,
    ): {
      outputCode: string,
    Severity: Minor
    Found in packages/babel-core/src/transformation/file/generate.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 index.js has 281 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import assert from "assert";
    import * as t from "@babel/types";
    import template from "@babel/template";
    import chunk from "lodash/chunk";
    
    
    Severity: Minor
    Found in packages/babel-helper-module-transforms/src/index.js - About 2 hrs to fix

      Function output has 68 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        async output(summary) {
          const goodnews = [
            summary.allowed.success.length + " valid programs parsed without error",
            summary.allowed.failure.length +
              " invalid programs produced a parsing error",
      Severity: Major
      Found in scripts/parser-tests/utils/parser-test-runner.js - About 2 hrs to fix

        Function parseMaybeAssign has 68 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            parseMaybeAssign(
              noIn?: ?boolean,
              refExpressionErrors?: ?ExpressionErrors,
              afterLeftParse?: Function,
              refNeedsArrowPos?: ?Pos,
        Severity: Major
        Found in packages/babel-parser/src/plugins/flow.js - About 2 hrs to fix

          Function applyReplacement has 68 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function applyReplacement(
            placeholder: Placeholder,
            ast: BabelNodeFile,
            replacement: any,
          ) {
          Severity: Major
          Found in packages/babel-template/src/populate.js - About 2 hrs to fix

            Function classTransformer has 68 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function classTransformer(
                path: NodePath,
                file,
                builtinClasses: ReadonlySet<string>,
                isLoose: boolean,
            Severity: Major
            Found in packages/babel-plugin-transform-classes/src/transformClass.js - About 2 hrs to fix

              Function exports has 67 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              module.exports = function () {
                return {
                  name: "babel-source",
                  load(id) {
                    const matches = id.match(/packages\/(babel-[^/]+)\/src\//);
              Severity: Major
              Found in scripts/rollup-plugin-babel-source.js - About 2 hrs to fix

                Function buildMappingData has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function buildMappingData(map: SourceMap): ResolvedMappings {
                  const consumer = new sourceMap.SourceMapConsumer({
                    ...map,
                
                    // This is a bit hack. .addMapping expects source values to be relative,
                Severity: Major
                Found in packages/babel-core/src/transformation/file/merge-map.js - About 2 hrs to fix

                  Function recurseDescriptors has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      const ignored = yield* (function* recurseDescriptors(
                        config: {
                          plugins: Array<UnloadedDescriptor>,
                          presets: Array<UnloadedDescriptor>,
                        },
                  Severity: Major
                  Found in packages/babel-core/src/config/full.js - About 2 hrs to fix

                    File missing-plugin-helper.js has 278 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    // @flow
                    
                    const pluginNameMap = {
                      classProperties: {
                        syntax: {
                    Severity: Minor
                    Found in packages/babel-core/src/parser/util/missing-plugin-helper.js - About 2 hrs to fix

                      Consider simplifying this complex logical expression.
                      Open

                        if (
                          nodeType === "Pureish" ||
                          "FunctionDeclaration" === nodeType ||
                          "FunctionExpression" === nodeType ||
                          "StringLiteral" === nodeType ||
                      Severity: Critical
                      Found in packages/babel-types/src/validators/generated/index.js - About 2 hrs to fix

                        File rewrite-live-references.js has 277 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import assert from "assert";
                        import * as t from "@babel/types";
                        import template from "@babel/template";
                        import simplifyAccess from "@babel/helper-simple-access";
                        
                        

                          Function readNumber has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            readNumber(startsWithDot: boolean): void {
                              const start = this.state.pos;
                              let isFloat = false;
                              let isBigInt = false;
                              let isNonOctalDecimalInt = false;
                          Severity: Major
                          Found in packages/babel-parser/src/tokenizer/index.js - About 2 hrs to fix

                            Function isFlow has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export function isFlow(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
                              Severity
                              Category
                              Status
                              Source
                              Language