trufflesuite/truffle

View on GitHub
packages/debugger/lib/txlog/reducers.js

Summary

Maintainability
F
4 days
Test Coverage

Function transactionLog has 326 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function transactionLog(state = DEFAULT_TX_LOG, action) {
  const { pointer, newPointer, step } = action;
  const node = state.byPointer[pointer];
  switch (action.type) {
    case actions.RECORD_ORIGIN:
Severity: Major
Found in packages/debugger/lib/txlog/reducers.js - About 1 day to fix

    Function transactionLog has a Cognitive Complexity of 80 (exceeds 5 allowed). Consider refactoring.
    Open

    function transactionLog(state = DEFAULT_TX_LOG, action) {
      const { pointer, newPointer, step } = action;
      const node = state.byPointer[pointer];
      switch (action.type) {
        case actions.RECORD_ORIGIN:
    Severity: Minor
    Found in packages/debugger/lib/txlog/reducers.js - About 1 day 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 reducers.js has 401 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import debugModule from "debug";
    const debug = debugModule("debugger:txlog:reducers");
    
    import { combineReducers } from "redux";
    
    
    Severity: Minor
    Found in packages/debugger/lib/txlog/reducers.js - About 5 hrs to fix

      Avoid too many return statements within this function.
      Open

            return {
              byPointer: {
                ...state.byPointer,
                [pointer]: modifiedNode
              }
      Severity: Major
      Found in packages/debugger/lib/txlog/reducers.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

              return newState;
        Severity: Major
        Found in packages/debugger/lib/txlog/reducers.js - About 30 mins to fix

          There are no issues that match your filters.

          Category
          Status