packages/babel-helper-member-expression-to-functions/src/index.js

Summary

Maintainability
F
3 days
Test Coverage

Function handle has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring.
Open

  handle(member) {
    const { node, parent, parentPath } = member;

    if (member.isOptionalMemberExpression()) {
      // Transforming optional chaining requires we replace ancestors.
Severity: Minor
Found in packages/babel-helper-member-expression-to-functions/src/index.js - About 1 day 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 handle has 192 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  handle(member) {
    const { node, parent, parentPath } = member;

    if (member.isOptionalMemberExpression()) {
      // Transforming optional chaining requires we replace ancestors.
Severity: Major
Found in packages/babel-helper-member-expression-to-functions/src/index.js - About 7 hrs to fix

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

    import * as t from "@babel/types";
    
    class AssignmentMemoiser {
      constructor() {
        this._map = new WeakMap();
    Severity: Minor
    Found in packages/babel-helper-member-expression-to-functions/src/index.js - About 2 hrs to fix

      Consider simplifying this complex logical expression.
      Open

          if (
            // for (MEMBER of ARR)
            // for (MEMBER in ARR)
            parentPath.isForXStatement({ left: node }) ||
            // { KEY: MEMBER } = OBJ
      Severity: Critical
      Found in packages/babel-helper-member-expression-to-functions/src/index.js - About 2 hrs to fix

        Function isInDetachedTree has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

        function isInDetachedTree(path) {
          while (path) {
            if (path.isProgram()) break;
        
            const { parentPath, container, listKey } = path;
        Severity: Minor
        Found in packages/babel-helper-member-expression-to-functions/src/index.js - About 1 hr 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 (startingOptional.node.optional) break;
        Severity: Major
        Found in packages/babel-helper-member-expression-to-functions/src/index.js - About 45 mins to fix

          Avoid too many return statements within this function.
          Open

                return;
          Severity: Major
          Found in packages/babel-helper-member-expression-to-functions/src/index.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                  return;
            Severity: Major
            Found in packages/babel-helper-member-expression-to-functions/src/index.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                    return;
              Severity: Major
              Found in packages/babel-helper-member-expression-to-functions/src/index.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return;
                Severity: Major
                Found in packages/babel-helper-member-expression-to-functions/src/index.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                        return;
                  Severity: Major
                  Found in packages/babel-helper-member-expression-to-functions/src/index.js - About 30 mins to fix

                    Function toNonOptional has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function toNonOptional(path, base) {
                      const { node } = path;
                      if (path.isOptionalMemberExpression()) {
                        return t.memberExpression(base, node.property, node.computed);
                      }
                    Severity: Minor
                    Found in packages/babel-helper-member-expression-to-functions/src/index.js - About 25 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

                    There are no issues that match your filters.

                    Category
                    Status