mohnstrudel/ycms

View on GitHub

Showing 42 of 42 total issues

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 _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 _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 _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 26 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';

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

                  $(document).delegate(rails.formSubmitSelector, 'ajax:beforeSend.rails', function(event) {
                    if (this == event.target) rails.disableFormElements($(this));
                  });
                public/assets/ckeditor/application-56a1c7231485c7ea14ed14a767c7fc8d7cfc133308e31300f9751430a78dec38.js on lines 1982..1984

                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 54.

                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

                  $(document).delegate(rails.formSubmitSelector, 'ajax:complete.rails', function(event) {
                    if (this == event.target) rails.enableFormElements($(this));
                  });
                public/assets/ckeditor/application-56a1c7231485c7ea14ed14a767c7fc8d7cfc133308e31300f9751430a78dec38.js on lines 1978..1980

                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 54.

                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

                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) { 

                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

                        if (this._options.maxFilesCount > 0) {
                          if ( uploadedCount > this._options.maxFilesCount) { 
                            this._error('maxFilesError', 'name');
                            return false;
                          }
                public/assets/ckeditor/application-56a1c7231485c7ea14ed14a767c7fc8d7cfc133308e31300f9751430a78dec38.js on lines 429..434

                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 53.

                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._options.minFilesCount > 0) {
                          if ( uploadedCount < this._options.minFilesCount) {
                            this._error('minFilesError', 'name');
                            return false;
                          }
                public/assets/ckeditor/application-56a1c7231485c7ea14ed14a767c7fc8d7cfc133308e31300f9751430a78dec38.js on lines 422..427

                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 53.

                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 ( scrollBottom > bottomTarget ) {
                                if ( !this._bottomlock ) {
                                    $(this.container).trigger("jes:bottomThreshold");
                                    this._bottomlock = true;
                                }
                public/assets/ckeditor/application-56a1c7231485c7ea14ed14a767c7fc8d7cfc133308e31300f9751430a78dec38.js on lines 1426..1433

                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 47.

                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 ( scrollTop < topTarget ) {
                                if ( !this._toplock ) {
                                    $(this.container).trigger("jes:topThreshold");
                                    this._toplock = true;
                                }
                public/assets/ckeditor/application-56a1c7231485c7ea14ed14a767c7fc8d7cfc133308e31300f9751430a78dec38.js on lines 1436..1443

                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 47.

                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

                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;    

                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;

                  Avoid too many return statements within this function.
                  Open

                          return true;                

                    Function _onComplete has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        _onComplete: function(id, fileName, result){
                            qq.FileUploaderBasic.prototype._onComplete.apply(this, arguments);
                    
                            var item = this._getItemByFileId(id);
                            var asset = result.asset ? result.asset : result;

                    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 _onComplete has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        _onComplete: function(id, fileName, result){
                            qq.FileUploaderBasic.prototype._onComplete.apply(this, arguments);
                    
                            var item = this._getItemByFileId(id);
                            var asset = result.asset ? result.asset : result;

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Severity
                    Category
                    Status
                    Source
                    Language