Showing 59 of 84 total issues
Function getConf
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
var getConf = function (win) {
win = win || window;
var conf = [],
len = CONF_FIELDS.length,
i;
- 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 getOtherOS
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
var getOtherOS = function (win, ua) {
var otherBrowser = new Browser();
if (has('wiiu', win)) {
- 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 getFlashVersion
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
var getFlashVersion = function () {
if (can(nav, 'plugins') && !has('ActiveXObject')) { // standards compliant browsers
return checkPlugin('Shockwave Flash'); //Flash version
- 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 detect
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
var detect = function (win) {
win = win || window;
var document = win.document,
top = win.top,
- 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
} else if (browserType === TYPE.SAFARI) {
detectedBrowser = getOsFromUa(w, ua);
detectedBrowser.engine.version = parseIntIfMatch(ua, /AppleWebKit\/(\d+)/, 10);
// all versions: 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 2.0, 3.0, 3.1, 3.2, 4.0, 4.1, 5.0, 5.1, 6.0, 6.1, 7.0, 8.0
// optimal version coverage: 6.1, 7.0, 8.0
Avoid deeply nested control flow statements. Open
if (!looksLike(/Opera/i, ua)) { detectedBrowser.trustworthy = false; }
Avoid deeply nested control flow statements. Open
if (looksLike(/Presto\/(\d+\.\d+)/i, ua)) {
detectedBrowser.engine.version = parseFloatIfMatch(ua, /Presto\/(\d+\.\d+)/i);
} else if (looksLike(/AppleWebKit\/(\d+)/i, ua)) {
detectedBrowser.engine.version = parseIntIfMatch(ua, /AppleWebKit\/(\d+)/i, 10);
}
Avoid deeply nested control flow statements. Open
for (i = 0; i < len; i++) {
clonedScript.setAttribute(
childEl.attributes[i].name, childEl.attributes[i].value);
}
Avoid deeply nested control flow statements. Open
if (looksLike(/Nintendo/i, ua)) {
detectedBrowser.engine.name = 'presto';
detectedBrowser.version = '9.0';
detectedBrowser.console = true;
} else {
Function loadScript
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
var loadScript = function (urls, onLoaded, onError, requestTimeout, target) {
Function createXHR
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
var createXHR = function () {
var xhr;
// IE 9+, Modern Browsers
try {
- 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 createSpy
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
var createSpy = function (loadedModule, mockType) {
mockType = mockType || 'spy';
var spy,
cache = require.cache,
- 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 embedHtml
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
var embedHtml = function (htmlString, parentElem, callback, win) {
var originalDocWrite,
originalDocWriteln;
win = win || window;
- 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 getFramePosition
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
var getFramePosition = function (pos) {
if (win.parent.frames[pos] || pos > 100) {
if (win.parent.frames[pos] === window) {
return '' + pos;
} 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 forIn
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
var forIn = function (obj, callback) {
var property;
for (property in obj) {
if (obj.hasOwnProperty(property)) {
if (callback(property, obj[property]) === 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 checkPlugin
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
var checkPlugin = function (name) {
/**
* @type plugin
* @property description
* @property version
- 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 triggerEvent
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
var triggerEvent = function(element, eventName) {
var doc = document,
evt;
if (doc.createEvent) {
- 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 getVersion
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
var getVersion = function (uaVersion, minVersion, maxVersion) {
var actualVersion = minVersion;
if (uaVersion >= minVersion) {
if (!maxVersion || uaVersion <= maxVersion) {
actualVersion = uaVersion;
- 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 getWinFocus
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
var getWinFocus = function (win) {
win = win || window;
if (has('$sf', win) && has('ext', win.$sf) && has('winHasFocus', win.$sf.ext)) {
return win.$sf.ext.winHasFocus() ? 1 : 0;
- 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"