owncloud/core

View on GitHub
core/js/js.js

Summary

Maintainability
F
3 wks
Test Coverage

File js.js has 2043 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * Disable console output unless DEBUG mode is enabled.
 * Add
 *      'debug' => true,
 * To the definition of $CONFIG in config/config.php to enable debug mode.
Severity: Major
Found in core/js/js.js - About 5 days to fix

    Function _generateHTML has a Cognitive Complexity of 220 (exceeds 5 allowed). Consider refactoring.
    Open

        $.datepicker._generateHTML = function( inst ) {
            var maxDraw, prevText, prev, nextText, next, currentText, gotoDate,
                controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin,
                monthNames, monthNamesShort, beforeShowDay, showOtherMonths,
                selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate,
    Severity: Minor
    Found in core/js/js.js - About 4 days 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 initCore has 267 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function initCore() {
        // setup tooltip
        $('.section .icon-info').tooltip({placement: 'right'});
    
        /**
    Severity: Major
    Found in core/js/js.js - About 1 day to fix

      Function _generateHTML has 240 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          $.datepicker._generateHTML = function( inst ) {
              var maxDraw, prevText, prev, nextText, next, currentText, gotoDate,
                  controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin,
                  monthNames, monthNamesShort, beforeShowDay, showOtherMonths,
                  selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate,
      Severity: Major
      Found in core/js/js.js - About 1 day to fix

        Function initCore has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
        Open

        function initCore() {
            // setup tooltip
            $('.section .icon-info').tooltip({placement: 'right'});
        
            /**
        Severity: Minor
        Found in core/js/js.js - About 1 day 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 extend has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
        Open

        jQuery.extend = jQuery.fn.extend = function() {
            var options, name, src, copy, copyIsArray, clone,
                target = arguments[0] || {},
                i = 1,
                length = arguments.length,
        Severity: Minor
        Found in core/js/js.js - About 6 hrs 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 position has 147 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        $.fn.position = function( options ) {
            if ( !options || !options.of ) {
                return _position.apply( this, arguments );
            }
        
        
        Severity: Major
        Found in core/js/js.js - About 5 hrs to fix

          OC has 39 functions (exceeds 20 allowed). Consider refactoring.
          Open

          var OC = {
              PERMISSION_CREATE: 4,
              PERMISSION_READ: 1,
              PERMISSION_UPDATE: 2,
              PERMISSION_DELETE: 8,
          Severity: Minor
          Found in core/js/js.js - About 5 hrs to fix

            Function appSettings has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
            Open

                appSettings: function (args) {
                    if (typeof args === 'undefined' || typeof args.appid === 'undefined') {
                        throw {name: 'MissingParameter', message: 'The parameter appid is missing'};
                    }
                    var props = {scriptName: 'settings.php', cache: true};
            Severity: Minor
            Found in core/js/js.js - About 3 hrs 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 filePath has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
            Open

                filePath: function (app, type, file) {
                    var isCore = OC.coreApps.indexOf(app) !== -1,
                        link = OC.getRootPath();
                    if (file.substring(file.length - 3) === 'php' && !isCore) {
                        link += '/index.php/apps/' + app;
            Severity: Minor
            Found in core/js/js.js - About 3 hrs 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 tipsy has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

            jQuery.fn.tipsy = function (argument) {
                console.warn('Deprecation warning: tipsy is deprecated. Use tooltip instead.');
                if (typeof argument === 'object' && argument !== null) {
            
                    // tipsy defaults
            Severity: Minor
            Found in core/js/js.js - About 2 hrs 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 _attachments has 60 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            $.datepicker._attachments = function (input, inst) {
                    var showOn, buttonText, buttonImage,
                        appendText = this._get(inst, "appendText"),
                        isRTL = this._get(inst, "isRTL");
            
            
            Severity: Major
            Found in core/js/js.js - About 2 hrs to fix

              Function _attachments has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

              $.datepicker._attachments = function (input, inst) {
                      var showOn, buttonText, buttonImage,
                          appendText = this._get(inst, "appendText"),
                          isRTL = this._get(inst, "isRTL");
              
              
              Severity: Minor
              Found in core/js/js.js - About 2 hrs 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 appSettings has 51 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  appSettings: function (args) {
                      if (typeof args === 'undefined' || typeof args.appid === 'undefined') {
                          throw {name: 'MissingParameter', message: 'The parameter appid is missing'};
                      }
                      var props = {scriptName: 'settings.php', cache: true};
              Severity: Major
              Found in core/js/js.js - About 2 hrs to fix

                Function tipsy has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                jQuery.fn.tipsy = function (argument) {
                    console.warn('Deprecation warning: tipsy is deprecated. Use tooltip instead.');
                    if (typeof argument === 'object' && argument !== null) {
                
                        // tipsy defaults
                Severity: Major
                Found in core/js/js.js - About 2 hrs to fix

                  Function initMouseTrack has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function initMouseTrack() {
                          var interval = 120;  // 2 minutes
                          if (oc_config.session_lifetime) {
                              interval = Math.floor(oc_config.session_lifetime / 2);
                          }
                  Severity: Minor
                  Found in core/js/js.js - About 1 hr to fix

                    Function parseQueryString has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        parseQueryString: function (queryString) {
                            var parts,
                                pos,
                                components,
                                result = {},
                    Severity: Minor
                    Found in core/js/js.js - About 1 hr to fix

                      Function extend has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      jQuery.extend = jQuery.fn.extend = function() {
                          var options, name, src, copy, copyIsArray, clone,
                              target = arguments[0] || {},
                              i = 1,
                              length = arguments.length,
                      Severity: Minor
                      Found in core/js/js.js - About 1 hr to fix

                        Function filePath has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            filePath: function (app, type, file) {
                                var isCore = OC.coreApps.indexOf(app) !== -1,
                                    link = OC.getRootPath();
                                if (file.substring(file.length - 3) === 'php' && !isCore) {
                                    link += '/index.php/apps/' + app;
                        Severity: Minor
                        Found in core/js/js.js - About 1 hr to fix

                          Function parseQueryString has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                          Open

                              parseQueryString: function (queryString) {
                                  var parts,
                                      pos,
                                      components,
                                      result = {},
                          Severity: Minor
                          Found in core/js/js.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 hide has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              hide: function ($row, callback) {
                                  var self = this;
                                  var $notification = $('#notification');
                          
                                  if (_.isFunction($row)) {
                          Severity: Minor
                          Found in core/js/js.js - About 1 hr to fix

                            Function joinPaths has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                joinPaths: function () {
                                    if (arguments.length < 1) {
                                        return '';
                                    }
                                    var path = '';
                            Severity: Minor
                            Found in core/js/js.js - About 1 hr to fix

                              Function computerFileSize has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  computerFileSize: function (string) {
                                      if (typeof string !== 'string') {
                                          return null;
                                      }
                              
                              
                              Severity: Minor
                              Found in core/js/js.js - About 1 hr to fix

                                Function dialog_createTitlebar has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    $.ui.dialog.dialog_createTitlebar = function() {
                                    var uiDialogTitle;
                                    this.uiDialogTitlebar = $( "<div>" );
                                    this._addClass( this.uiDialogTitlebar,
                                        "ui-dialog-titlebar", "ui-widget-header ui-helper-clearfix" );
                                Severity: Minor
                                Found in core/js/js.js - About 1 hr to fix

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

                                      joinPaths: function () {
                                          if (arguments.length < 1) {
                                              return '';
                                          }
                                          var path = '';
                                  Severity: Minor
                                  Found in core/js/js.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 showHtml has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      showHtml: function (html, options) {
                                          options = options || {};
                                          _.defaults(options, {
                                              timeout: 0
                                          });
                                  Severity: Minor
                                  Found in core/js/js.js - About 1 hr to fix

                                    Function getDimensions has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    function getDimensions( elem ) {
                                        var raw = elem[ 0 ];
                                        if ( raw.nodeType === 9 ) {
                                            return {
                                                width: elem.width(),
                                    Severity: Minor
                                    Found in core/js/js.js - About 1 hr to fix

                                      Function generateUrl has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          generateUrl: function (url, params, options) {
                                              var defaultOptions = {
                                                      escape: true
                                                  },
                                                  allOptions = options || {};
                                      Severity: Minor
                                      Found in core/js/js.js - About 1 hr to fix

                                        Function _show has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                            _show: function (container, dir, leafname, leaflink) {
                                                var self = this;
                                        
                                                this._clear(container);
                                        
                                        
                                        Severity: Minor
                                        Found in core/js/js.js - About 1 hr to fix

                                          Function jqxhr has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                          Open

                                                      var jqxhr = $.get(OC.filePath(props.appid, '', props.scriptName), function (data) {
                                                          popup.html(data).ready(function () {
                                                              popup.prepend('<span class="arrow ' + arrowclass + '"></span><h2>' + t('core', 'Settings') + '</h2><a class="close"></a>').show();
                                                              popup.find('.close').bind('click', function () {
                                                                  popup.remove();
                                          Severity: Minor
                                          Found in core/js/js.js - About 1 hr to fix

                                            Function position has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                            $.fn.position = function( options ) {
                                                if ( !options || !options.of ) {
                                                    return _position.apply( this, arguments );
                                                }
                                            
                                            
                                            Severity: Minor
                                            Found in core/js/js.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

                                                                    if (!$('#app-sidebar').hasClass('hidden') && !$('#app-sidebar').hasClass('disappear')) {
                                                                        controlsWidth -= $('#app-sidebar').width();
                                                                    }
                                            Severity: Major
                                            Found in core/js/js.js - About 45 mins to fix

                                              Avoid deeply nested control flow statements.
                                              Open

                                                                  if ( copyIsArray ) {
                                                                      copyIsArray = false;
                                                                      clone = src && jQuery.isArray(src) ? src : [];
                                              
                                                                  } else {
                                              Severity: Major
                                              Found in core/js/js.js - About 45 mins to fix

                                                Avoid deeply nested control flow statements.
                                                Open

                                                                        if (!$('#app-sidebar').hasClass('hidden') && !$('#app-sidebar').hasClass('disappear')) {
                                                                            controlsWidth -= $('#app-sidebar').width();
                                                                        }
                                                Severity: Major
                                                Found in core/js/js.js - About 45 mins to fix

                                                  Avoid deeply nested control flow statements.
                                                  Open

                                                                  } else if ( copy !== undefined ) {
                                                                      target[ name ] = copy;
                                                                  }
                                                  Severity: Major
                                                  Found in core/js/js.js - About 45 mins to fix

                                                    Avoid deeply nested control flow statements.
                                                    Open

                                                                            switch ( col ) {
                                                                                case 0: calender += " ui-datepicker-group-first";
                                                                                    cornerClass = " ui-corner-" + ( isRTL ? "right" : "left" ); break;
                                                                                case numMonths[ 1 ] - 1: calender += " ui-datepicker-group-last";
                                                                                    cornerClass = " ui-corner-" + ( isRTL ? "left" : "right" ); break;
                                                    Severity: Major
                                                    Found in core/js/js.js - About 45 mins to fix

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

                                                          addScript: function (app, script, ready) {
                                                              var deferred, path = OC.filePath(app, 'js', script + '.js');
                                                              if (!OC.addScript.loaded[path]) {
                                                                  if (ready) {
                                                                      deferred = $.getScript(path, ready);
                                                      Severity: Minor
                                                      Found in core/js/js.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 registerXHRForErrorProcessing has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                          registerXHRForErrorProcessing: function (xhr) {
                                                              var loadCallback = function () {
                                                                  if (xhr.readyState !== 4) {
                                                                      return;
                                                                  }
                                                      Severity: Minor
                                                      Found in core/js/js.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 _onPopState has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                          _onPopState: function (e) {
                                                              if (this._cancelPop) {
                                                                  this._cancelPop = false;
                                                                  return;
                                                              }
                                                      Severity: Minor
                                                      Found in core/js/js.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 humanFileSize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                      function humanFileSize(size, skipSmallSizes) {
                                                          var humanList = ['B', 'KB', 'MB', 'GB', 'TB'];
                                                          // Calculate Log with base 1024: size = 1024 ** order
                                                          var order = size > 0 ? Math.floor(Math.log(size) / Math.log(1024)) : 0;
                                                          // Stay in range of the byte sizes that are defined
                                                      Severity: Minor
                                                      Found in core/js/js.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 _pushState has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                          _pushState: function (params, replace) {
                                                              var strParams;
                                                              if (typeof(params) === 'string') {
                                                                  strParams = params;
                                                              }
                                                      Severity: Minor
                                                      Found in core/js/js.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 naturalSortCompare has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                          naturalSortCompare: function (a, b) {
                                                              var x;
                                                              var aa = OC.Util._chunkify(a);
                                                              var bb = OC.Util._chunkify(b);
                                                      
                                                      
                                                      Severity: Minor
                                                      Found in core/js/js.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 computerFileSize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                          computerFileSize: function (string) {
                                                              if (typeof string !== 'string') {
                                                                  return null;
                                                              }
                                                      
                                                      
                                                      Severity: Minor
                                                      Found in core/js/js.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 hide has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                          hide: function ($row, callback) {
                                                              var self = this;
                                                              var $notification = $('#notification');
                                                      
                                                              if (_.isFunction($row)) {
                                                      Severity: Minor
                                                      Found in core/js/js.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

                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                      Open

                                                          attach: function (targetName, targetObject, options) {
                                                              var plugins = this.getPlugins(targetName);
                                                              plugins = this.sortPluginsByPriority(plugins);
                                                              for (var i = 0; i < plugins.length; i++) {
                                                                  var plugin = plugins[i].plugin;
                                                      Severity: Major
                                                      Found in core/js/js.js and 1 other location - About 3 hrs to fix
                                                      core/js/js.js on lines 947..956

                                                      Duplicated Code

                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                      Tuning

                                                      This issue has a mass of 105.

                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                      Refactorings

                                                      Further Reading

                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                      Open

                                                          detach: function (targetName, targetObject, options) {
                                                              var plugins = this.getPlugins(targetName);
                                                              plugins = this.sortPluginsByPriority(plugins);
                                                              for (var i = 0; i < plugins.length; i++) {
                                                                  var plugin = plugins[i].plugin;
                                                      Severity: Major
                                                      Found in core/js/js.js and 1 other location - About 3 hrs to fix
                                                      core/js/js.js on lines 929..938

                                                      Duplicated Code

                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                      Tuning

                                                      This issue has a mass of 105.

                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                      Refactorings

                                                      Further Reading

                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                      Open

                                                              if ( this._canAdjustMonth( inst, -1, drawYear, drawMonth ) ) {
                                                                  prev = $( "<a>" )
                                                                      .attr( {
                                                                          "class": "ui-datepicker-prev ui-corner-all",
                                                                          "data-handler": "prev",
                                                      Severity: Major
                                                      Found in core/js/js.js and 1 other location - About 2 hrs to fix
                                                      core/js/js.js on lines 2995..3023

                                                      Duplicated Code

                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                      Tuning

                                                      This issue has a mass of 90.

                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                      Refactorings

                                                      Further Reading

                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                      Open

                                                              if ( this._canAdjustMonth( inst, +1, drawYear, drawMonth ) ) {
                                                                  next = $( "<a>" )
                                                                      .attr( {
                                                                          "class": "ui-datepicker-next ui-corner-all",
                                                                          "data-handler": "next",
                                                      Severity: Major
                                                      Found in core/js/js.js and 1 other location - About 2 hrs to fix
                                                      core/js/js.js on lines 2960..2988

                                                      Duplicated Code

                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                      Tuning

                                                      This issue has a mass of 90.

                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                      Refactorings

                                                      Further Reading

                                                      Similar blocks of code found in 4 locations. Consider refactoring.
                                                      Open

                                                          if ( options.at[ 0 ] === "right" ) {
                                                              basePosition.left += targetWidth;
                                                          } else if ( options.at[ 0 ] === "center" ) {
                                                              basePosition.left += targetWidth / 2;
                                                          }
                                                      Severity: Major
                                                      Found in core/js/js.js and 3 other locations - About 1 hr to fix
                                                      core/js/js.js on lines 2735..2739
                                                      core/js/js.js on lines 2759..2763
                                                      core/js/js.js on lines 2765..2769

                                                      Duplicated Code

                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                      Tuning

                                                      This issue has a mass of 65.

                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                      Refactorings

                                                      Further Reading

                                                      Similar blocks of code found in 4 locations. Consider refactoring.
                                                      Open

                                                              if ( options.my[ 0 ] === "right" ) {
                                                                  position.left -= elemWidth;
                                                              } else if ( options.my[ 0 ] === "center" ) {
                                                                  position.left -= elemWidth / 2;
                                                              }
                                                      Severity: Major
                                                      Found in core/js/js.js and 3 other locations - About 1 hr to fix
                                                      core/js/js.js on lines 2729..2733
                                                      core/js/js.js on lines 2735..2739
                                                      core/js/js.js on lines 2765..2769

                                                      Duplicated Code

                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                      Tuning

                                                      This issue has a mass of 65.

                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                      Refactorings

                                                      Further Reading

                                                      Similar blocks of code found in 4 locations. Consider refactoring.
                                                      Open

                                                          if ( options.at[ 1 ] === "bottom" ) {
                                                              basePosition.top += targetHeight;
                                                          } else if ( options.at[ 1 ] === "center" ) {
                                                              basePosition.top += targetHeight / 2;
                                                          }
                                                      Severity: Major
                                                      Found in core/js/js.js and 3 other locations - About 1 hr to fix
                                                      core/js/js.js on lines 2729..2733
                                                      core/js/js.js on lines 2759..2763
                                                      core/js/js.js on lines 2765..2769

                                                      Duplicated Code

                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                      Tuning

                                                      This issue has a mass of 65.

                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                      Refactorings

                                                      Further Reading

                                                      Similar blocks of code found in 4 locations. Consider refactoring.
                                                      Open

                                                              if ( options.my[ 1 ] === "bottom" ) {
                                                                  position.top -= elemHeight;
                                                              } else if ( options.my[ 1 ] === "center" ) {
                                                                  position.top -= elemHeight / 2;
                                                              }
                                                      Severity: Major
                                                      Found in core/js/js.js and 3 other locations - About 1 hr to fix
                                                      core/js/js.js on lines 2729..2733
                                                      core/js/js.js on lines 2735..2739
                                                      core/js/js.js on lines 2759..2763

                                                      Duplicated Code

                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                      Tuning

                                                      This issue has a mass of 65.

                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                      Refactorings

                                                      Further Reading

                                                      Identical blocks of code found in 2 locations. Consider refactoring.
                                                      Open

                                                                              if (!$('#app-sidebar').hasClass('hidden') && !$('#app-sidebar').hasClass('disappear')) {
                                                                                  controlsWidth -= $('#app-sidebar').width();
                                                                              }
                                                      Severity: Major
                                                      Found in core/js/js.js and 1 other location - About 1 hr to fix
                                                      core/js/js.js on lines 1817..1819

                                                      Duplicated Code

                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                      Tuning

                                                      This issue has a mass of 57.

                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                      Refactorings

                                                      Further Reading

                                                      Identical blocks of code found in 2 locations. Consider refactoring.
                                                      Open

                                                                              if (!$('#app-sidebar').hasClass('hidden') && !$('#app-sidebar').hasClass('disappear')) {
                                                                                  controlsWidth -= $('#app-sidebar').width();
                                                                              }
                                                      Severity: Major
                                                      Found in core/js/js.js and 1 other location - About 1 hr to fix
                                                      core/js/js.js on lines 1826..1828

                                                      Duplicated Code

                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                      Tuning

                                                      This issue has a mass of 57.

                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                      Refactorings

                                                      Further Reading

                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                      Open

                                                              nextText = ( !navigationAsDateFormat ? nextText : this.formatDate( nextText,
                                                                  this._daylightSavingAdjust( new Date( drawYear, drawMonth + stepMonths, 1 ) ),
                                                                  this._getFormatConfig( inst ) ) );
                                                      Severity: Minor
                                                      Found in core/js/js.js and 1 other location - About 50 mins to fix
                                                      core/js/js.js on lines 2956..2958

                                                      Duplicated Code

                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                      Tuning

                                                      This issue has a mass of 51.

                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                      Refactorings

                                                      Further Reading

                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                      Open

                                                              prevText = ( !navigationAsDateFormat ? prevText : this.formatDate( prevText,
                                                                  this._daylightSavingAdjust( new Date( drawYear, drawMonth - stepMonths, 1 ) ),
                                                                  this._getFormatConfig( inst ) ) );
                                                      Severity: Minor
                                                      Found in core/js/js.js and 1 other location - About 50 mins to fix
                                                      core/js/js.js on lines 2991..2993

                                                      Duplicated Code

                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                      Tuning

                                                      This issue has a mass of 51.

                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                      Refactorings

                                                      Further Reading

                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                      Open

                                                              for (var i = 0; i < parts.length; i++) {
                                                                  result.push(encodeURIComponent(parts[i]));
                                                              }
                                                      Severity: Minor
                                                      Found in core/js/js.js and 1 other location - About 35 mins to fix
                                                      apps/files/js/filelist.js on lines 2048..2050

                                                      Duplicated Code

                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                      Tuning

                                                      This issue has a mass of 46.

                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                      Refactorings

                                                      Further Reading

                                                      There are no issues that match your filters.

                                                      Category
                                                      Status