senecajs/seneca

View on GitHub
lib/act.js

Summary

Maintainability
C
7 hrs
Test Coverage

Function do_act has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    do_act: function (instance, opts, origmsg, origreply) {
        let timedout = false;
        const actmsg = intern.make_actmsg(origmsg);
        const meta = new meta_1.Meta(instance, opts, origmsg, origreply);
        // Gated actions must complete before further actions can start.
Severity: Minor
Found in lib/act.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 handle_inward_break has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    handle_inward_break: function (inward, act_instance, data, actdef, origmsg) {
        if (!inward)
            return false;
        const msg = data.msg;
        const reply = data.reply;
Severity: Minor
Found in lib/act.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

Function execute_action has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    execute_action: function (execspec, act_instance, opts, actctxt, msg, meta, reply) {
Severity: Major
Found in lib/act.js - About 50 mins to fix

    Function handle_reply has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        handle_reply: function (opts, meta, actctxt, actmsg, err, out, reply_meta) {
    Severity: Major
    Found in lib/act.js - About 50 mins to fix

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

          handle_reply: function (opts, meta, actctxt, actmsg, err, out, reply_meta) {
              meta.end = Date.now();
              const delegate = actctxt.seneca;
              const reply = actctxt.reply;
              const data = {
      Severity: Minor
      Found in lib/act.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 handle_inward_break has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          handle_inward_break: function (inward, act_instance, data, actdef, origmsg) {
      Severity: Minor
      Found in lib/act.js - About 35 mins to fix

        Function execute_action has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            execute_action: function (execspec, act_instance, opts, actctxt, msg, meta, reply) {
                const private$ = act_instance.private$;
                const actdef = meta.prior
                    ? private$.actdef[meta.prior]
                    : act_instance.find(msg);
        Severity: Minor
        Found in lib/act.js - About 35 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 process_outward has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            process_outward: function (actctxt, data) {
                const act_instance = actctxt.seneca;
                const outwardres = act_instance.order.outward.execSync(actctxt, data);
                if (outwardres.err) {
                    throw outwardres.err;
        Severity: Minor
        Found in lib/act.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