Showing 1,982 of 1,982 total issues

Avoid deeply nested control flow statements.
Open

      if (is("ImportSpecifier", parent, { imported: node })) return;
Severity: Major
Found in packages/babel-types/src/definitions/core.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

          if (!body) return; // bailed
    Severity: Major
    Found in packages/babel-types/src/converters/gatherSequenceExpressions.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                    if (
                      (privateNames.has(name) &&
                        !privateNames.has(getName) &&
                        !privateNames.has(setName)) ||
                      (privateNames.has(name) &&
      Severity: Major
      Found in packages/babel-helper-create-class-features-plugin/src/index.js - About 45 mins to fix

        Function isPatternLike has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        export function isPatternLike(node: ?Object, opts?: Object): boolean {
          if (!node) return false;
        
          const nodeType = node.type;
          if (
        Severity: Minor
        Found in packages/babel-types/src/validators/generated/index.js - About 45 mins 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 isExpression has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        export function isExpression(node: ?Object, opts?: Object): boolean {
          if (!node) return false;
        
          const nodeType = node.type;
          if (
        Severity: Minor
        Found in packages/babel-types/src/validators/generated/index.js - About 45 mins 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

        Avoid deeply nested control flow statements.
        Open

                if (deep) {
                  newNode[field] =
                    type === "File" && field === "comments"
                      ? maybeCloneComments(node.comments, deep, withoutLoc)
                      : cloneIfNodeOrArray(node[field], true, withoutLoc);
        Severity: Major
        Found in packages/babel-types/src/clone/cloneNode.js - About 45 mins to fix

          Function buildFieldsInitNodes has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            ref,
            superRef,
            props,
            privateNamesMap,
            state,
          Severity: Minor
          Found in packages/babel-helper-create-class-features-plugin/src/fields.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                      if (node.typeParameters) {
                        existing.typeParameters.params = removeTypeDuplicates(
                          existing.typeParameters.params.concat(node.typeParameters.params),
                        );
                      }
            Severity: Major
            Found in packages/babel-types/src/modifications/flow/removeTypeDuplicates.js - About 45 mins to fix

              Function isStatement has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              export function isStatement(node: ?Object, opts?: Object): boolean {
                if (!node) return false;
              
                const nodeType = node.type;
                if (
              Severity: Minor
              Found in packages/babel-types/src/validators/generated/index.js - About 45 mins 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 buildPrivateStaticFieldInitSpec has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              function buildPrivateStaticFieldInitSpec(prop, privateNamesMap) {
                const privateName = privateNamesMap.get(prop.node.key.id.name);
                const { id, getId, setId, initAdded } = privateName;
                const isAccessor = getId || setId;
              
              
              Severity: Minor
              Found in packages/babel-helper-create-class-features-plugin/src/fields.js - About 45 mins 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

              Avoid deeply nested control flow statements.
              Open

                            if (
                              privateNames.has(setName) ||
                              (privateNames.has(name) && !privateNames.has(getName))
                            ) {
                              throw path.buildCodeFrameError("Duplicate private field");
              Severity: Major
              Found in packages/babel-helper-create-class-features-plugin/src/index.js - About 45 mins to fix

                Function ObjectProperty has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                export function ObjectProperty(node: Object) {
                  this.printJoin(node.decorators, node);
                
                  if (node.computed) {
                    this.token("[");
                Severity: Minor
                Found in packages/babel-generator/src/generators/types.js - About 45 mins 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 set has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                  set(member, value) {
                    const { classRef, privateNamesMap, file } = this;
                    const { name } = member.node.property.id;
                    const {
                      id,
                Severity: Minor
                Found in packages/babel-helper-create-class-features-plugin/src/fields.js - About 45 mins 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 assertVersion has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                function assertVersion(range: string | number): void {
                  if (typeof range === "number") {
                    if (!Number.isInteger(range)) {
                      throw new Error("Expected string or integer value.");
                    }
                Severity: Minor
                Found in packages/babel-core/src/config/helpers/config-api.js - About 45 mins 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 ClassDeclaration has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                export function ClassDeclaration(node: Object, parent: Object) {
                  if (
                    !this.format.decoratorsBeforeExport ||
                    (!t.isExportDefaultDeclaration(parent) &&
                      !t.isExportNamedDeclaration(parent))
                Severity: Minor
                Found in packages/babel-generator/src/generators/classes.js - About 45 mins 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

                Avoid deeply nested control flow statements.
                Open

                          switch (node.type) {
                            case "VariableDeclarator": {
                              if (node.init === null) {
                                const declaration = redeclarator.parentPath;
                                // The following uninitialized var declarators should not be removed
                Severity: Major
                Found in packages/babel-plugin-transform-parameters/src/params.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                              if (parentPath.get("property").isBaseType("number")) {
                                state.candidates.push({ cause: "indexGetter", path });
                                return;
                              }
                  Severity: Major
                  Found in packages/babel-plugin-transform-parameters/src/rest.js - About 45 mins to fix

                    Function normalizeOptions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export default function normalizeOptions(config: ResolvedConfig): {} {
                      const {
                        filename,
                        cwd,
                        filenameRelative = typeof filename === "string"
                    Severity: Minor
                    Found in packages/babel-core/src/transformation/normalize-opts.js - About 45 mins 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 FlowExportDeclaration has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function FlowExportDeclaration(node: Object) {
                      if (node.declaration) {
                        const declar = node.declaration;
                        this.print(declar, node);
                        if (!t.isStatement(declar)) this.semicolon();
                    Severity: Minor
                    Found in packages/babel-generator/src/generators/flow.js - About 45 mins 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 exit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                          exit({ node }) {
                            let hasChange = false;
                            for (let i = 0; i < node.body.length; i++) {
                              const bodyNode = node.body[i];
                              if (bodyNode?._blockHoist != null) {
                    Severity: Minor
                    Found in packages/babel-core/src/transformation/block-hoist-plugin.js - About 45 mins 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