Showing 48 of 305 total issues
File resilient.js
has 2004 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/*! resilient - v0.4.0 - MIT License - https://github.com/resilient-http/resilient.js */
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.resilient = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
var _ = require('./utils')
module.exports = Cache
Function 23
has 280 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
},{}],23:[function(require,module,exports){
/*! lil-http - v0.1.17 - MIT License - https://github.com/lil-js/http */
;(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['exports'], factory)
Function 11
has 210 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
},{"./defaults":3,"./servers":18,"./utils":20}],11:[function(require,module,exports){
var _ = require('./utils')
var http = require('./http')
var ResilientError = require('./error')
var resilientOptions = require('./defaults').resilientOptions
Function 12
has 161 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
},{"./defaults":3,"./error":5,"./http":7,"./utils":20}],12:[function(require,module,exports){
var EventBus = require('lil-event')
var _ = require('./utils')
var Sync = require('./sync')
var Cache = require('./cache')
Function 13
has 152 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
},{"./cache":1,"./client":2,"./evaluator":6,"./middleware":9,"./options":10,"./resolvers/discovery":14,"./sync":19,"./utils":20,"lil-event":22}],13:[function(require,module,exports){
var _ = require('./utils')
var Servers = require('./servers')
var Requester = require('./requester')
var ResilientError = require('./error')
Function Resolver
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
Open
function Resolver (resilient, options, cb) {
cb = wrapHandler(cb)
var sync = resilient._sync
var middleware = resilient._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 Resolver
has 118 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function Resolver (resilient, options, cb) {
cb = wrapHandler(cb)
var sync = resilient._sync
var middleware = resilient._middleware
Function Resolver
has 118 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function Resolver (resilient, options, cb) {
cb = wrapHandler(cb)
var sync = resilient._sync
var middleware = resilient._middleware
Function 4
has 110 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
},{}],4:[function(require,module,exports){
var _ = require('./utils')
var Servers = require('./servers')
var Requester = require('./requester')
var ResilientError = require('./error')
Function 18
has 108 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
},{"./defaults":3}],18:[function(require,module,exports){
var _ = require('./utils')
var Server = require('./server')
var RoundRobin = require('./roundrobin')
Function 20
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
},{"./utils":20}],20:[function(require,module,exports){
var _ = exports
var toStr = Object.prototype.toString
var slice = Array.prototype.slice
var hasOwn = Object.prototype.hasOwnProperty
Function 2
has 96 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
},{"./utils":20}],2:[function(require,module,exports){
var _ = require('./utils')
var resolver = require('./resolver')
var http = require('./http')
Function 15
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
},{"../discovery":4,"../error":5,"../requester":11,"./service":15}],15:[function(require,module,exports){
var _ = require('../utils')
var ResilientError = require('../error')
module.exports = ServiceResolve
Function 3
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
},{"./http":7,"./resolver":13,"./utils":20}],3:[function(require,module,exports){
var defaults = module.exports = Object.create(null)
defaults.service = {
method: 'GET',
Function 22
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
},{}],22:[function(require,module,exports){
/*! lil-event - v0.1 - MIT License - https://github.com/lil-js/event */
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['exports'], factory)
Function 24
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
},{}],24:[function(require,module,exports){
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['exports'], factory)
} else if (typeof exports === 'object') {
Function 7
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
},{}],7:[function(require,module,exports){
var _ = require('./utils')
var IS_BROWSER = typeof window === 'object' && window
var JSON_MIME = /application\/json/i
Function 10
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
},{"./utils":20,"midware":24}],10:[function(require,module,exports){
var _ = require('./utils')
var defaults = require('./defaults')
var Servers = require('./servers')
Function ServiceResolve
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function ServiceResolve (resilient) {
var middleware = resilient._middleware
var options = resilient.options('discovery')
function isCacheEnabled () {
Function ServiceResolve
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function ServiceResolve (resilient) {
var middleware = resilient._middleware
var options = resilient.options('discovery')
function isCacheEnabled () {