Showing 30 of 111 total issues
File http.js
has 1088 lines of code (exceeds 250 allowed). Consider refactoring. Open
const fs = require('fs')
const http = require('http')
const crypto = require('crypto')
const connect = require('connect')
const sinon = require('sinon')
Function responseBody
has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function responseBody (middleware, filter) {
return function (req, res, next) {
// Apply request filter, if present
if (filter && !helpers.filterRequest(filter, res)) {
return next()
- Read upRead up
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 responseBody
has 100 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function responseBody (middleware, filter) {
return function (req, res, next) {
// Apply request filter, if present
if (filter && !helpers.filterRequest(filter, res)) {
return next()
Function requestBody
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function requestBody (middleware, filter) {
return function (req, res, next) {
// Ignore HTTP verbs that does not support bodies
if (req.method === 'GET' || req.method === 'HEAD') {
return next()
- Read upRead up
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 requestBody
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function requestBody (middleware, filter) {
return function (req, res, next) {
// Ignore HTTP verbs that does not support bodies
if (req.method === 'GET' || req.method === 'HEAD') {
return next()
Function forward
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function forward (route, opts, req, res, done) {
// Clone request object to avoid side-effects on mutations
const forwardReq = helpers.cloneRequest(req, opts)
// Run the forward phase middleware
Function forward
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function forward (route, opts, req, res, done) {
// Clone request object to avoid side-effects on mutations
const forwardReq = helpers.cloneRequest(req, opts)
// Run the forward phase middleware
- Read upRead up
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 eachSeries
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function eachSeries (arr, iterator, cb) {
cb = cb || noop
if (!Array.isArray(arr) || !arr.length) return cb()
const stack = arr.slice()
- Read upRead up
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 eachConcurrently
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function eachConcurrently (arr, iterator, cb) {
cb = cb || noop
if (!Array.isArray(arr) || !arr.length) return cb()
var errors = []
- Read upRead up
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 retryRequest
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function retryRequest (route, params, opts, req, res, handler) {
Function exports
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function (query) {
return function (req, res, next) {
const parsedUrl = url.parse(req.url, true)
if (!req.query) {
- Read upRead up
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 forwardStrategy
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function forwardStrategy (route, opts, req, res, resolver) {
Function exports
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
module.exports = function wsProxy (opts, req, socket, head, done) {
Function concurrently
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
exports.concurrently = function (opts, req, socket, head, done) {
Function replayHandler
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function replayHandler (route, params, opts, req, next) {
Function exports
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
module.exports = function replay (route, opts, req, res, next) {
Function replayer
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function replayer (route, replayReq, replayRes, opts, next) {
Function forwardRetryRequest
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function forwardRetryRequest (route, opts, forwardReq, res, done) {
Function forwardRequest
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function forwardRequest (route, opts, forwardReq, res, done) {
Function exports
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
module.exports = function (opts, res, task, done, onRetry) {