ooxif/vue-vuex-promise-store

View on GitHub

Showing 8 of 8 total issues

Function registerModule has 93 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function registerModule (store, moduleName) {
  store.registerModule(moduleName, {
    namespaced: true,

    state: createInitialState(store.state[moduleName]),
Severity: Major
Found in src/index.js - About 3 hrs to fix

    Function registerModule has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

    function registerModule (store, moduleName) {
      store.registerModule(moduleName, {
        namespaced: true,
    
        state: createInitialState(store.state[moduleName]),
    Severity: Minor
    Found in src/index.js - About 3 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 attachMethods has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

    function attachMethods (context, store, moduleName, key, queue) {
      const syncQueue = queue || []
    
      context.thenSync = function thenSync (onFulfilled, onRejected) {
        if (!context.isPending) {
    Severity: Minor
    Found in src/index.js - About 3 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

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

    const MODULE_NAME = 'promise'
    
    function raise (message) {
      throw new Error(`[vue-vuex-promise-store] ${message}`)
    }
    Severity: Minor
    Found in src/index.js - About 2 hrs to fix

      Function attachMethods has 60 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function attachMethods (context, store, moduleName, key, queue) {
        const syncQueue = queue || []
      
        context.thenSync = function thenSync (onFulfilled, onRejected) {
          if (!context.isPending) {
      Severity: Major
      Found in src/index.js - About 2 hrs to fix

        Function thenSync has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          context.thenSync = function thenSync (onFulfilled, onRejected) {
            if (!context.isPending) {
              let ok
              let result
        
        
        Severity: Minor
        Found in src/index.js - About 1 hr to fix

          Function updateContext has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          function updateContext (context, isFulfilled, value, syncQueue) {
            context.isPending = false
          
            if (isFulfilled) {
              context.isFulfilled = true
          Severity: Minor
          Found in 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

          Function attachMethods has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          function attachMethods (context, store, moduleName, key, queue) {
          Severity: Minor
          Found in src/index.js - About 35 mins to fix
            Severity
            Category
            Status
            Source
            Language