browsejs/browse.js

View on GitHub

Showing 9 of 12 total issues

Function _ajaxNonce has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

function _ajaxNonce(url, options) {
  if(false === options.cache && options.method.match(__methods_with_response__)) {
    if(!url.match(/_=/)) {
      url += !url.match(/\?/)
        ? '?_='
Severity: Minor
Found in lib/ajax-request.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 _scrollYTick has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

function _scrollYTick(obj, toY, duration, mode, callback) {
Severity: Minor
Found in lib/animation.js - About 35 mins to fix

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

    function _getAnimationStep(beginTime, duration, beginVal, endVal, mode) {
    Severity: Minor
    Found in lib/animation.js - About 35 mins to fix

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

      function _readyInit(callback) {
        var done = false
        var init = function(e) {
          if(e.type === 'readystatechange' && document.readyState !== 'complete') {
            return
      Severity: Minor
      Found in lib/ready.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 _eventDataFromDefsAndParams has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      function _eventDataFromDefsAndParams(defs, allowed, params) {
        var input = { }
        /* eslint-disable guard-for-in */
        for(var key in defs) {
          input[key] = defs[key]
      Severity: Minor
      Found in lib/events.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 _getOpacity has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function _getOpacity(style) {
        if('opacity' in style) {
          return style.opacity !== '' ? parseFloat(style.opacity) : 1.0
        }
        else /*if('filter' in style)*/ {
      Severity: Minor
      Found in lib/opacity.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 _nonIeKbEvent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function _nonIeKbEvent(type, input) {
        var e
        try {
          e = new window.KeyboardEvent(type, input)
          var keys = ['keyCode', 'location']
      Severity: Minor
      Found in lib/keyboard-events.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 _setOpacity has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function _setOpacity(style, value) {
        value = parseFloat(value)
        if(isNaN(value) || value < 0 || value > 1) {
          throw Error('Opacity value must be >= 0 and <= 1')
        }
      Severity: Minor
      Found in lib/opacity.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 _noFilesInForm has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function _noFilesInForm(form) {
        var elements = form.elements
        for(var idx = 0; idx < elements.length; ++idx) {
          if('file' === elements[idx].type.toLowerCase()) {
            if(elements[idx].files && elements[idx].files.length) {
      Severity: Minor
      Found in lib/ajax-multipart.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