vshushkov/redux-models

View on GitHub

Showing 6 of 6 total issues

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

import { combineReducers } from 'redux';
import isFunction from 'lodash/isFunction';
import isArray from 'lodash/isArray';
import isEqual from 'lodash/isEqual';
import isEmpty from 'lodash/isEmpty';
Severity: Minor
Found in src/index.js - About 3 hrs to fix

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

    function createDefaultMethodReducer({ types }) {
      const [start, success, failure, reset] = types;
    
      return function defaultMethodReducer(state = [], action) {
        if (action.type === reset) {
    Severity: Minor
    Found in src/index.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 defaultMethodReducer has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      return function defaultMethodReducer(state = [], action) {
        if (action.type === reset) {
          return [];
        }
    
    
    Severity: Minor
    Found in src/index.js - About 1 hr to fix

      Function createModel has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function createModel(options = {}) {
        let {
          typePrefix,
          modelState,
          modelsState,
      Severity: Minor
      Found in src/index.js - About 1 hr to fix

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

        export function normalizeMethods(methods, { mixins = null } = {}) {
          const baseMethods = isArray(methods)
            ? methods
                .map(method => ({
                  methodName: isString(method) ? method : method.name,
        Severity: Minor
        Found in src/utils.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 createReducers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        function createReducers({
          typePrefix,
          modelName,
          methods,
          reducer,
        Severity: Minor
        Found in src/index.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

        Severity
        Category
        Status
        Source
        Language