galetahub/ckeditor

View on GitHub

Showing 22 of 42 total issues

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

/**
 * http://github.com/valums/file-uploader
 * 
 * Multiple file upload component with progress-bar, drag-and-drop. 
 * © 2010 Andrew Valums ( andrew(at)valums.com ) 

    Function obj2url has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

    qq.obj2url = function(obj, temp, prefixDone){
        var uristrings = [],
            prefix = '&',
            add = function(nextObj, i){
                var nextTemp = temp 

    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 handleRemote has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        handleRemote: function(element) {
          var method, url, data,
            crossDomain = element.data('cross-domain') || null,
            dataType = element.data('type') || ($.ajaxSettings && $.ajaxSettings.dataType),
            options;
    Severity: Minor
    Found in app/assets/javascripts/ckeditor/filebrowser/javascripts/rails.js - About 1 hr to fix

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

              init: function(options, obj) {
                  obj.options = $.extend({
                      nextPage: ".pagination a[rel=next]",
                      previousPage: ".pagination a[rel=previous]"
                  }, options);

        Function FileUploaderBasic has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        qq.FileUploaderBasic = function(o){
            this._options = {
                // set to true to see the server response
                debug: false,
                action: '/server/upload',

          Function _createInput has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              _createInput: function(){                
                  var input = document.createElement("input");
                  
                  if (this._options.multiple){
                      input.setAttribute("multiple", "multiple");

            Function FileUploader has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            qq.FileUploader = function(o){
                // call parent constructor
                qq.FileUploaderBasic.apply(this, arguments);
                
                // additional options    

              Function obj2url has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              qq.obj2url = function(obj, temp, prefixDone){
                  var uristrings = [],
                      prefix = '&',
                      add = function(nextObj, i){
                          var nextTemp = temp 

                Function loadPage has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        loadPage: function(url, placement, callback) {
                            //The hash with methods list
                            //depends from placement
                            var actions = {
                                    top: {

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

                      _setupDragDrop: function(){
                          var self = this,
                              dropArea = this._find(this._element, 'drop');
                  
                          var dz = new qq.UploadDropZone({

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

                        _setupDragDrop: function(){
                            var self = this,
                                dropArea = this._find(this._element, 'drop');                        
                    
                            var dz = new qq.UploadDropZone({

                      Function _upload has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          _upload: function(id, params){
                              var file = this._files[id],
                                  name = this.getName(id),
                                  size = this.getSize(id);
                                      

                        Function _attachEvents has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            _attachEvents: function(){
                                var self = this;              
                                          
                                qq.attach(self._element, 'dragover', function(e){
                                    if (!self._isValidFileDrag(e)) return;

                          Function scrollHandler has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  scrollHandler: function(ev) {
                                      var $scrollable = this.scrollContainer,
                                          $entities = this.entities,
                                          $firstEntity = $entities.first(),
                                          $lastEntity = $entities.last();

                            Function _validateFile has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                            Open

                                _validateFile: function(file){
                                    var name, size;
                                    
                                    if (file.value){
                                        // it is a file input            

                            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 _createUploadHandler has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                _createUploadHandler: function(){
                                    var self = this,
                                        handlerClass;        
                                    
                                    if(qq.UploadHandlerXhr.isSupported()){           

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

                              CKEDITOR.editorConfig = function( config )
                              {
                                // Define changes to default configuration here. For example:
                                // config.language = 'fr';
                                // config.uiColor = '#AADC6E';
                              Severity: Minor
                              Found in app/assets/javascripts/ckeditor/config.js - About 1 hr to fix

                                Function _validateFiles has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    _validateFiles: function(files){
                                        var uploadedCount = this._filesUploaded + files.length;
                                        
                                        if (this._options.maxFilesCount > 0) {
                                          if ( uploadedCount > this._options.maxFilesCount) { 
                                Severity: Minor
                                Found in app/assets/javascripts/ckeditor/filebrowser/javascripts/fileuploader.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 indexOf has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                Open

                                qq.indexOf = function(arr, elt, from){
                                    if (arr.indexOf) return arr.indexOf(elt, from);
                                    
                                    from = from || 0;
                                    var len = arr.length;    
                                Severity: Minor
                                Found in app/assets/javascripts/ckeditor/filebrowser/javascripts/fileuploader.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

                                Avoid too many return statements within this function.
                                Open

                                      return false;
                                Severity: Major
                                Found in app/assets/javascripts/ckeditor/filebrowser/javascripts/rails.js - About 30 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language