adam-26/react-router-dispatcher

View on GitHub

Showing 5 of 17 total issues

Function isDispatchActionsEqual has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Confirmed

function isDispatchActionsEqual(arr1, arr2) {
    // Determine if a function was passed.
    const isFunc1 = typeof arr1 === 'function';
    const isFunc2 = typeof arr2 === 'function';
    if (isFunc1 || isFunc2) {
Severity: Minor
Found in src/RouteDispatcher.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 resolveActionSets has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Confirmed

export function resolveActionSets(routeComponents, dispatchActions, initParamFuncName, isLifecycleMethod, actionFilter) {
    const actionSets = parseDispatchActions(dispatchActions);
    const resolvedActionSets = [];

    actionSets.forEach(actionSet => {
Severity: Minor
Found in src/dispatchRouteActions.js - About 1 hr to fix

    Function isDispatchActionsEqual has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Confirmed

    function isDispatchActionsEqual(arr1, arr2) {
        // Determine if a function was passed.
        const isFunc1 = typeof arr1 === 'function';
        const isFunc2 = typeof arr2 === 'function';
        if (isFunc1 || isFunc2) {
    Severity: Minor
    Found in src/RouteDispatcher.js - About 1 hr to fix

      Function withActions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Confirmed

      export default function withActions(mapParamsToProps, ...actions) {
          if (!(typeof mapParamsToProps === 'undefined' || mapParamsToProps === null)) {
              invariant(typeof mapParamsToProps === 'function', '"mapParamsToProps" must be either a function, or null.');
          }
      
      
      Severity: Minor
      Found in src/withActions.js - About 45 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 resolveActionSets has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Confirmed

      export function resolveActionSets(routeComponents, dispatchActions, initParamFuncName, isLifecycleMethod, actionFilter) {
      Severity: Minor
      Found in src/dispatchRouteActions.js - About 35 mins to fix
        Severity
        Category
        Status
        Source
        Language