Showing 566 of 915 total issues
Avoid deeply nested control flow statements. Open
else if (data[x] instanceof Blob) {
f.append(x, data[x], data.name);
}
else {
f.append(x, data[x]);
Avoid deeply nested control flow statements. Open
if (input) {
// Remove it.
if (!(inputs instanceof NodeList)) {
inputs = [inputs];
}
Avoid deeply nested control flow statements. Open
if (!loose) loose = next;
Function _createButton
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
_createButton: function(t, e, i, n, s, a) {
Function getLinks
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
getLinks: function(__promoUri, promo) {
var hasGoodLinks = false;
var links = promo.links.filter(function(link) {
var match = _.intersection(link.rel, CONFIG.PROMO_RELS);
- 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
Avoid deeply nested control flow statements. Open
if (link[attr]) {
hasMedia = true;
}
Avoid deeply nested control flow statements. Open
if (jsonpCallback) {
// jsonp case.
var body = data.substring(index + 2);
Avoid deeply nested control flow statements. Open
if (this.events[name][i]) {
// Emit on the local instance of this
callback.call(this, name, i);
}
Function _animateZoom
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
_animateZoom: function(t, e, i, n, s, a) {
Avoid deeply nested control flow statements. Open
if (moreDetailedData) {
tagToAppend = generateArticleParts(moreDetailedData);
}
Avoid deeply nested control flow statements. Open
if (el) {
input.value = data[x].value;
}
else if (_this.domInstance(null, data[x])) {
input.value = data[x].innerHTML || data[x].innerText;
Avoid deeply nested control flow statements. Open
if (!media) {
media = {};
}
Function parseMetaLinks
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
parseMetaLinks: function(key, value, whitelistRecord) {
if (typeof value !== "object" || typeof value === "string") {
return [];
}
- 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
Avoid deeply nested control flow statements. Open
if ('files' in data[x] && data[x].files.length > 0) {
f.append(x, data[x].files[0]);
}
Avoid deeply nested control flow statements. Open
if (detailedData.indexOf('playerType=facebook') > -1 && detailedData.indexOf('auto_play=false') === -1) {
detailedData = detailedData.replace('playerType=facebook', 'playerType=facebook&auto_play=false');
}
Avoid deeply nested control flow statements. Open
else if (el && data[x].name !== x) {
data[x].setAttribute('name', x);
data[x].name = x;
}
Function getData
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
getData: function(url, twitter, whitelistRecord) {
// do not process if there is a whitelist record for this domain as processing will take longer
if (!whitelistRecord.isDefault && whitelistRecord.isAllowed && whitelistRecord.isAllowed('twitter.player')) {return;}
- 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
Avoid deeply nested control flow statements. Open
if (data[x].length === 1) {
data[x] = data[x][0];
}
Function getMeta
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
getMeta: function(meta) {
function getAuthor(value) {
if (typeof value === "string") {
if (/^https?:\/\//i.test(value)) {
- 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
Avoid deeply nested control flow statements. Open
if(uiElement.onInit) {
uiElement.onInit(item);
}