lib/protocols/http/passes/replay.js

Summary

Maintainability
A
3 hrs
Test Coverage

Function retryRequest has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

function retryRequest (route, params, opts, req, res, handler) {
Severity: Minor
Found in lib/protocols/http/passes/replay.js - About 45 mins to fix

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

    function replayHandler (route, params, opts, req, next) {
    Severity: Minor
    Found in lib/protocols/http/passes/replay.js - About 35 mins to fix

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

      function replayer (route, replayReq, replayRes, opts, next) {
      Severity: Minor
      Found in lib/protocols/http/passes/replay.js - About 35 mins to fix

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

        module.exports = function replay (route, opts, req, res, next) {
        Severity: Minor
        Found in lib/protocols/http/passes/replay.js - About 35 mins to fix

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

          function replayer (route, replayReq, replayRes, opts, next) {
            return function doReplay (err) {
              if (err) {
                return route.emit('replay:error', err, replayReq, replayRes)
              }
          Severity: Minor
          Found in lib/protocols/http/passes/replay.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 setRequestParams has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          function setRequestParams (req, opts) {
            const target = req.rocky.options.target || opts.target
            const url = parseUrl(target)
            const params = setupReq(opts.ssl || {}, opts, req)
          
          
          Severity: Minor
          Found in lib/protocols/http/passes/replay.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

          There are no issues that match your filters.

          Category
          Status