senecajs/seneca-flow

View on GitHub
src/flow.ts

Summary

Maintainability
A
0 mins
Test Coverage

Function flow has 295 lines of code (exceeds 25 allowed). Consider refactoring.
Invalid

function flow(this: any, options: any) {
  const seneca: any = this

  seneca
    .fix('sys:flow')
Severity: Major
Found in src/flow.ts - About 1 day to fix

    Function flow has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
    Invalid

    function flow(this: any, options: any) {
      const seneca: any = this
    
      seneca
        .fix('sys:flow')
    Severity: Minor
    Found in src/flow.ts - 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

    File flow.ts has 358 lines of code (exceeds 250 allowed). Consider refactoring.
    Invalid

    /* Copyright © 2022-2023 Richard Rodger and Seneca Project Contributors, MIT License. */
    
    
    import { One, Child, Open, Skip } from 'gubu'
    
    
    Severity: Minor
    Found in src/flow.ts - About 4 hrs to fix

      Function apply_step has 60 lines of code (exceeds 25 allowed). Consider refactoring.
      Invalid

        async function apply_step(
          seneca: any,
          flowDef: any,
          stepDefs: any,
          flowEnt: any,
      Severity: Major
      Found in src/flow.ts - About 2 hrs to fix

        Function msg_define_flowdef has 60 lines of code (exceeds 25 allowed). Consider refactoring.
        Invalid

          async function msg_define_flowdef(this: any, msg: any) {
            let ok = true
            let sysFlowDef = this.entity('sys/flowDef')
        
            // NOTE: use name as id to ensure uniqueness
        Severity: Major
        Found in src/flow.ts - About 2 hrs to fix

          Function apply_step has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Invalid

              seneca: any,
              flowDef: any,
              stepDefs: any,
              flowEnt: any,
              flowData: any,
          Severity: Minor
          Found in src/flow.ts - About 45 mins to fix

            There are no issues that match your filters.

            Category
            Status