Showing 88 of 160 total issues
Function 2
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
},{"./resource-shadow":6,"_process":2}],2:[function(require,module,exports){
// shim for using process in browser
var process = module.exports = {};
Function write
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Buffer.prototype.write = function (string, offset, length, encoding) {
// Support both (string, offset, length, encoding)
// and the legacy (string, encoding, offset, length)
if (isFinite(offset)) {
if (!isFinite(length)) {
Function 4
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
},{}],4:[function(require,module,exports){
function HttpHandler() {
}
Function 3
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
},{}],3:[function(require,module,exports){
function M() { this._events = {}; }
M.prototype = {
on: function(ev, cb) {
this._events || (this._events = {});
Function _augment
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Buffer._augment = function (arr) {
arr.constructor = Buffer
arr._isBuffer = true
// save reference to original Uint8Array get/set methods before overwriting
Function Buffer
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function Buffer (subject, encoding, noZero) {
if (!(this instanceof Buffer))
return new Buffer(subject, encoding, noZero)
var type = typeof subject
Function mirrorObject
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
ResourceShadow.prototype.mirrorObject = function(source, target) {
var self = this;
if (typeof source !== 'object' || source === null || typeof target !== 'object' || target === null) {
return false;
}
Function mirrorObject
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
ResourceShadow.prototype.mirrorObject = function(source, target) {
var self = this;
if (typeof source !== 'object' || typeof target !== 'object') {
return false;
}
Function ajax
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
HttpHandler.prototype.ajax = function(method, url, headers, body, callback) {
// simple browser implementation
var request = new XMLHttpRequest();
request.open(method, url, true);
- 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 write
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.write = function(buffer, value, offset, isLE, mLen, nBytes) {
var e, m, c,
eLen = nBytes * 8 - mLen - 1,
eMax = (1 << eLen) - 1,
eBias = eMax >> 1,
Function ajax
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
HttpHandler.prototype.ajax = function(method, url, headers, body, callback) {
// simple browser implementation
var request = new XMLHttpRequest();
request.open(method, url, true);
Function ajax
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
HttpHandler.prototype.ajax = function(method, url, headers, body, callback) {
// simple browser implementation
var request = new XMLHttpRequest();
request.open(method, url, true);
Function load
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
ResourceShadow.prototype.load = function(preJson) {
this.loadLocal();
if (this.loading || this.saving) {
Function processJsonFromServer
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
ResourceShadow.prototype.processJsonFromServer = function(serverJson, preJson) {
this.shadow = serverJson;
var currentLocalJson = this.localStorage.getItem(this.localKey);
if (serverJson !== preJson) {
Function processJsonFromServer
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
ResourceShadow.prototype.processJsonFromServer = function(serverJson, preJson) {
this.shadow = serverJson;
var currentLocalJson = this.localStorage.getItem(this.localKey);
if (serverJson !== preJson) {
Function load
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
ResourceShadow.prototype.load = function(preJson) {
this.loadLocal();
if (this.loading || this.saving) {
Function parse
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
JSON.parse = function (text, reviver) {
// The parse method takes a text and an optional reviver function, and returns
// a JavaScript value if the text is a valid JSON text.
var j;
Function property
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Assertion.prototype.property = function (name, val) {
if (this.flags.own) {
this.assert(
Object.prototype.hasOwnProperty.call(this.obj, name)
, function(){ return 'expected ' + i(this.obj) + ' to have own property ' + i(name) }
Function Assertion
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function Assertion (obj, flag, parent) {
this.obj = obj;
this.flags = {};
if (undefined != parent) {
Function toString
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Buffer.prototype.toString = function (encoding, start, end) {
var loweredCase = false
start = start >>> 0
end = end === undefined || end === Infinity ? this.length : end >>> 0