store2be/redux-belt

View on GitHub

Showing 6 of 34 total issues

Function simpleAsync has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

export default function simpleAsync(descriptor) {
  if (typeof descriptor.effect !== 'function') {
    throw new Error('Invalid descriptor for simpleAsync: "effect" must be a function')
  }
  return function* simpleSaga(action) {
Severity: Minor
Found in src/simple-async.js - About 5 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 crud.test.js has 359 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import jsc from 'jsverify'
import update from 'immutability-helper'

import * as generators from './generators'
import * as utils from './utils'
Severity: Minor
Found in src/crud.test.js - About 4 hrs to fix

    Function configureCrudReducer has 111 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const configureCrudReducer = extractors => (state, action, t) => {
      const { payload, type } = action
      switch (type) {
        case t.CREATE:
          return update(state, {
    Severity: Major
    Found in src/crud.js - About 4 hrs to fix

      File simple-async.test.js has 345 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import { call, put } from 'redux-saga/effects'
      
      import simpleAsync from './simple-async'
      import * as utils from './utils'
      
      
      Severity: Minor
      Found in src/simple-async.test.js - About 4 hrs to fix

        Function simpleAsync has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export default function simpleAsync(descriptor) {
          if (typeof descriptor.effect !== 'function') {
            throw new Error('Invalid descriptor for simpleAsync: "effect" must be a function')
          }
          return function* simpleSaga(action) {
        Severity: Minor
        Found in src/simple-async.js - About 1 hr to fix

          Function simpleSaga has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            return function* simpleSaga(action) {
              if (!action.meta) {
                throw new Error(
                  `The action ${
                    action.type
          Severity: Minor
          Found in src/simple-async.js - About 1 hr to fix
            Severity
            Category
            Status
            Source
            Language