senecajs/seneca-entity

View on GitHub
src/lib/store.ts

Summary

Maintainability
A
0 mins
Test Coverage

Function Store has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
Invalid

function Store(plugin_opts: any) {
  const tag_count_map: any = {}

  function make_tag(store_name: any) {
    tag_count_map[store_name] = (tag_count_map[store_name] || 0) + 1
Severity: Minor
Found in src/lib/store.ts - About 6 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 Store has 99 lines of code (exceeds 25 allowed). Consider refactoring.
Invalid

function Store(plugin_opts: any) {
  const tag_count_map: any = {}

  function make_tag(store_name: any) {
    tag_count_map[store_name] = (tag_count_map[store_name] || 0) + 1
Severity: Major
Found in src/lib/store.ts - About 3 hrs to fix

    Function init has 88 lines of code (exceeds 25 allowed). Consider refactoring.
    Invalid

        init: function (instance: any, store_opts: any, store: any, cb: any) {
          const entspecs = []
    
          if (store_opts.map) {
            for (const canon in store_opts.map) {
    Severity: Major
    Found in src/lib/store.ts - About 3 hrs to fix

      Function reify_entity_wrap has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Invalid

        reify_entity_wrap: function (
          cmdfunc: any,
          cmd: string,
          zone?: string,
          base?: string,
      Severity: Minor
      Found in src/lib/store.ts - 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 reify_entity_wrap has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Invalid

        reify_entity_wrap: function (
          cmdfunc: any,
          cmd: string,
          zone?: string,
          base?: string,
      Severity: Minor
      Found in src/lib/store.ts - About 1 hr to fix

        Function outfunc has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Invalid

            const outfunc = function (this: any, msg: any, reply: any, meta: any) {
              if ('save' !== msg.cmd) {
                if (null == msg.q) {
                  msg.q = {}
        
        
        Severity: Minor
        Found in src/lib/store.ts - About 1 hr to fix

          Function reify_entity_wrap has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Invalid

              cmdfunc: any,
              cmd: string,
              zone?: string,
              base?: string,
              name?: string,
          Severity: Minor
          Found in src/lib/store.ts - About 35 mins to fix

            There are no issues that match your filters.

            Category
            Status