conversant/ad-libs.js

View on GitHub

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;
Severity: Minor
Found in lib/detect/safeframe.js - About 1 hr to fix

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)) {
Severity: Minor
Found in lib/detect/browser.js - About 55 mins to fix

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

Severity: Minor
Found in lib/detect/environment.js - About 55 mins to fix

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,
Severity: Minor
Found in lib/detect/capabilities.js - About 45 mins to fix

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
Severity: Major
Found in lib/detect/browser.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

            if (!looksLike(/Opera/i, ua)) { detectedBrowser.trustworthy = false; }
    Severity: Major
    Found in lib/detect/browser.js - About 45 mins to fix

      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);
              }
      Severity: Major
      Found in lib/detect/browser.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            for (i = 0; i < len; i++) {
                                clonedScript.setAttribute(
                                    childEl.attributes[i].name, childEl.attributes[i].value);
                            }
        Severity: Major
        Found in lib/dom/appendHtml.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                  if (looksLike(/Nintendo/i, ua)) {
                      detectedBrowser.engine.name = 'presto';
                      detectedBrowser.version = '9.0';
                      detectedBrowser.console = true;
                  } else {
          Severity: Major
          Found in lib/detect/browser.js - About 45 mins to fix

            Function loadScript has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            var loadScript = function (urls, onLoaded, onError, requestTimeout, target) {
            Severity: Minor
            Found in lib/loadScript.js - About 35 mins to fix

              Function createXHR has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              var createXHR = function () {
                  var xhr;
              
                  // IE 9+, Modern Browsers
                  try {
              Severity: Minor
              Found in lib/xhr.js - About 35 mins to fix

              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,
              Severity: Minor
              Found in lib/createSpy.js - About 35 mins to fix

              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;
              Severity: Minor
              Found in lib/dom/embedHtml.js - About 35 mins to fix

              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 {
              Severity: Minor
              Found in lib/detect/environment.js - About 35 mins to fix

              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) {
              Severity: Minor
              Found in lib/canHas.js - About 25 mins to fix

              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
              Severity: Minor
              Found in lib/detect/environment.js - About 25 mins to fix

              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) {
              Severity: Minor
              Found in lib/dom/triggerEvent.js - About 25 mins to fix

              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;
              Severity: Minor
              Found in lib/detect/browser.js - About 25 mins to fix

              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;
              Severity: Minor
              Found in lib/detect/safeframe.js - About 25 mins to fix

              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

              Severity
              Category
              Status
              Source
              Language