intale/ruby-blog

View on GitHub

Showing 30 of 54 total issues

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 _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 _upload has 27 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 _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

        Avoid deeply nested control flow statements.
        Open

                                    if (matchSubset(x.value, q)) {
                                        csub[csub.length] = x;
                                    }
        Severity: Major
        Found in app/assets/javascripts/jquery.autocomplete.js - About 45 mins to fix

          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 true;                
          Severity: Major
          Found in app/assets/javascripts/ckeditor/filebrowser/javascripts/fileuploader.js - About 30 mins to fix

            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

              Avoid too many return statements within this function.
              Open

                          return null;
              Severity: Major
              Found in app/assets/javascripts/jquery.autocomplete.js - About 30 mins to fix
                Severity
                Category
                Status
                Source
                Language