Showing 48 of 305 total issues
Function handleMissingServers
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function handleMissingServers (resilient, servers, options, getPreviousResponse, cb) {
Function handleMissingServers
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function handleMissingServers (resilient, servers, options, getPreviousResponse, cb) {
Function closePendingRequest
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function closePendingRequest (client) {
if (client) {
if (client.xhr) {
if (client.xhr.readyState !== 4) {
closeClient(client.xhr)
- 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 sort
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Servers.prototype.sort = function (operation, options) {
var servers = this.servers.slice(0)
if (servers.length) {
if (!options.get('disableWeight')) {
servers.sort(function (x, y) {
- 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 requestHandler
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function requestHandler (server, operation, options, resolve, nextServer, resilient) {
var start = _.now()
return function requestReporter (err, res) {
var latency = _.now() - start
resilient.emit('request:incoming', err, res, options, resilient)
- 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 mapServer
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function mapServer (data) {
var server
if (data instanceof Server) {
server = data
} else {
- 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 mapOptions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function mapOptions (options) {
if (typeof options === 'string') {
options = { url: options }
} else {
options = options || {}
- 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 roundRobinSort
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function roundRobinSort (servers, options) {
var size = 0
if (options && options.get('roundRobin')) {
var configSize = +options.get('roundRobinSize')
size = configSize > servers.length ? servers.length : configSize
- 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"