Showing 256 of 374 total issues
Function makeWithIfBinding
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function makeWithIfBinding(bindingKey, isWith, isNot, makeContextCallback) {
ko.bindingHandlers[bindingKey] = {
'init': function(element, valueAccessor, allBindings, viewModel, bindingContext) {
var didDisplayOnLastUpdate,
savedNodes;
Function renderTemplate
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
ko.renderTemplate = function (template, dataOrBindingContext, options, targetNodeOrNodeArray, renderMode) {
options = options || {};
if ((options['templateEngine'] || _templateEngine) == undefined)
throw new Error("Set a template engine before calling renderTemplate");
renderMode = renderMode || "replaceChildren";
Function executeTemplate
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function executeTemplate(targetNodeOrNodeArray, renderMode, template, bindingContext, options) {
options = options || {};
var firstTargetNode = targetNodeOrNodeArray && getFirstNodeFromPossibleArray(targetNodeOrNodeArray);
var templateDocument = firstTargetNode && firstTargetNode.ownerDocument;
var templateEngineToUse = (options['templateEngine'] || _templateEngine);
Function canvas
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
canvas: function(data) {
data = normalizeData(data);
// Module size of the generated QR code (i.e. 1-10).
var size = data.size >= 1 && data.size <= 10 ? data.size : 4;
Function decodePacket
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.decodePacket = function (data, binaryType, utf8decode) {
// String data
if (typeof data == 'string' || data === undefined) {
if (data.charAt(0) == 'b') {
return exports.decodeBase64Packet(data.substr(1), binaryType);
Function hasBinary
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function hasBinary(data) {
function _hasBinary(obj) {
if (!obj) return false;
Function 31
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
},{}],31:[function(require,module,exports){
module.exports = after
function after(count, callback, err_cb) {
var bail = false
- 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 onStatus
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
'onStatus': function(status) {
if (status) {
status.agents = status.agents || [];
this.logs((status.logs || []).map(function(log) {
return new Msg(log);
- 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 format
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Date[proto].format = function(mask) {
mask = Date.masks[mask] || mask || Date.masks["default"]
var self = this
, get = "get" + (mask.slice(0,4) == "UTC:" ? (mask=mask.slice(4), "UTC"):"")
Function forEachMixin
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
(arguments.length > 2 || mixins) && (extendeePrototype.hasOwnProperty("__mixins__") || (Object_defineProperties ? (Object_defineProperty(extendeePrototype, "__mixins__", { enumerable: false, value: [], writeable: false }).__mixins__.__hidden = true) : extendeePrototype.__mixins__ = [])) && Array_prototype_forEach.call(arguments, function forEachMixin(mixin, index, mixinValue, isFunction) {
isFunction = typeof mixin === 'function';
if (isFunction) {
__.prototype = mixin.prototype;
mixinValue = new mixin(extendeePrototype, constructor);
Function deconstructPacket
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.deconstructPacket = function(packet){
var buffers = [];
var packetData = packet.data;
function _deconstructPacket(data) {
Function activate
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Tab.prototype.activate = function (element, container, callback) {
var $active = container.find('> .active')
var transition = callback
&& $.support.transition
&& $active.hasClass('fade')
Function observable
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
ko.observable = function (initialValue) {
var _latestValue = initialValue;
function observable() {
if (arguments.length > 0) {
Function mapJsObjectGraph
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function mapJsObjectGraph(rootObject, mapInputCallback, visitedObjects) {
visitedObjects = visitedObjects || new objectLookup();
rootObject = mapInputCallback(rootObject);
var canHaveProperties = (typeof rootObject == "object") && (rootObject !== null) && (rootObject !== undefined) && (!(rootObject instanceof Date)) && (!(rootObject instanceof String)) && (!(rootObject instanceof Number)) && (!(rootObject instanceof Boolean));
Function topologicalSortBindings
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function topologicalSortBindings(bindings) {
// Depth-first sort
var result = [], // The list of key/handler pairs that we will return
bindingsConsidered = {}, // A temporary record of which bindings are already in 'result'
cyclicDependencyStack = []; // Keeps track of a depth-search so that, if there's a cycle, we know which bindings caused it
Function _removeBlobs
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _removeBlobs(obj, curKey, containingObject) {
if (!obj) return obj;
// convert any blob
if ((global.Blob && obj instanceof Blob) ||
Function save
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
save: function(data, path, callback) {
data = normalizeData(data);
switch (typeof path) {
case 'function':
Function add
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Decoder.prototype.add = function(obj) {
var packet;
if ('string' == typeof obj) {
packet = decodeString(obj);
if (exports.BINARY_EVENT == packet.type || exports.BINARY_ACK == packet.type) { // binary packet's json
Consider simplifying this complex logical expression. Open
Open
if (status) {
status.agents = status.agents || [];
this.logs((status.logs || []).map(function(log) {
return new Msg(log);
}));
Consider simplifying this complex logical expression. Open
Open
if (build && build.conf) {
var conf = build.conf;
this.conf = conf;
this.name(conf.name);
this.platform(conf.platform);