lowdefy/lowdefy

View on GitHub
packages/engine/src/Actions.js

Summary

Maintainability
C
1 day
Test Coverage

Function callAction has 76 lines of code (exceeds 25 allowed). Consider refactoring.
Confirmed

  async callAction({ action, arrayIndices, block, event, index, progress, responses }) {
    if (!this.actions[action.type]) {
      throw {
        error: new Error(`Invalid action type "${action.type}" at "${block.blockId}".`),
        type: action.type,
Severity: Major
Found in packages/engine/src/Actions.js - About 3 hrs to fix

    Function callActions has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Confirmed

      async callActions({ actions, arrayIndices, block, catchActions, event, eventName, progress }) {
        const startTimestamp = new Date();
        const responses = {};
        try {
          await this.callActionLoop({ actions, arrayIndices, block, event, responses, progress });
    Severity: Major
    Found in packages/engine/src/Actions.js - About 2 hrs to fix

      Function callActionLoop has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Confirmed

        async callActionLoop({ actions, arrayIndices, block, event, progress, responses }) {
          for (const [index, action] of actions.entries()) {
            try {
              if (action.async === true) {
                this.callAsyncAction({
      Severity: Minor
      Found in packages/engine/src/Actions.js - About 1 hr to fix

        Function callAction has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

          async callAction({ action, arrayIndices, block, event, index, progress, responses }) {
            if (!this.actions[action.type]) {
              throw {
                error: new Error(`Invalid action type "${action.type}" at "${block.blockId}".`),
                type: action.type,
        Severity: Minor
        Found in packages/engine/src/Actions.js - About 55 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 callActionLoop has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Confirmed

          async callActionLoop({ actions, arrayIndices, block, event, progress, responses }) {
            for (const [index, action] of actions.entries()) {
              try {
                if (action.async === true) {
                  this.callAsyncAction({
        Severity: Minor
        Found in packages/engine/src/Actions.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

        Function displayMessage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Confirmed

          displayMessage({ defaultMessage, duration, hideExplicitly, message, status }) {
            let close = () => undefined;
            if ((hideExplicitly && message !== false) || (!hideExplicitly && !type.isNone(message))) {
              close = this.context._internal.lowdefy._internal.displayMessage({
                content: type.isString(message) ? message : defaultMessage,
        Severity: Minor
        Found in packages/engine/src/Actions.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