zammad/zammad

View on GitHub
app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js

Summary

Maintainability
F
1 wk
Test Coverage

File jquery.fineuploader-3.0.js has 1628 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * http://github.com/Valums-File-Uploader/file-uploader
 *
 * Multiple file upload component with progress-bar, drag-and-drop, support for all modern browsers.
 *
Severity: Major
Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js - About 4 days to fix

    Function qq has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

    var qq = function(element) {
        "use strict";
    
        return {
            hide: function() {
    Severity: Minor
    Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js - About 5 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

    prototype has 35 functions (exceeds 20 allowed). Consider refactoring.
    Open

    qq.FineUploaderBasic.prototype = {
        log: function(str, level) {
            if (this._options.debug && (!level || level === 'info')) {
                qq.log('[FineUploader] ' + str);
            }
    Severity: Minor
    Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js - About 4 hrs to fix

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

      qq.obj2url = function(obj, temp, prefixDone){
          var uristrings = [],
              prefix = '&',
              add = function(nextObj, i){
                  var nextTemp = temp
      Severity: Minor
      Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js - About 4 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 qq has 99 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      var qq = function(element) {
          "use strict";
      
          return {
              hide: function() {
      Severity: Major
      Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js - About 3 hrs to fix

        Function FineUploader has 88 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        qq.FineUploader = function(o){
            // call parent constructor
            qq.FineUploaderBasic.apply(this, arguments);
        
            // additional options
        Severity: Major
        Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js - About 3 hrs to fix

          `` has 26 functions (exceeds 20 allowed). Consider refactoring.
          Open

          qq.extend(qq.FineUploader.prototype, {
              clearStoredFiles: function() {
                  qq.FineUploaderBasic.prototype.clearStoredFiles.apply(this, arguments);
                  this._listElement.innerHTML = "";
              },
          Severity: Minor
          Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js - About 3 hrs to fix

            Function _uploadFileList has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

                _uploadFileList: function(files){
                    var validationDescriptors, index, batchInvalid;
            
                    validationDescriptors = this._getValidationDescriptors(files);
                    if (validationDescriptors.length > 1) {
            Severity: Minor
            Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.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 FineUploaderBasic has 60 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            qq.FineUploaderBasic = function(o){
                var that = this;
                this._options = {
                    debug: false,
                    button: null,
            Severity: Major
            Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js - About 2 hrs to fix

              Function _createUploadHandler has 49 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  _createUploadHandler: function(){
                      var self = this,
                          handlerClass;
              
                      if(qq.UploadHandlerXhr.isSupported()){
              Severity: Minor
              Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js - About 1 hr to fix

                Function obj2url has 40 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
                Severity: Minor
                Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js - About 1 hr to fix

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

                      _upload: function(id, params){
                          this._options.onUpload(id, this.getName(id), true);
                  
                          var file = this._files[id],
                              name = this.getName(id),
                  Severity: Minor
                  Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js - About 1 hr to fix

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

                        _createInput: function(){
                            var input = document.createElement("input");
                    
                            if (this._options.multiple){
                                input.setAttribute("multiple", "multiple");
                    Severity: Minor
                    Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js - About 1 hr to fix

                      Function _controlFailureTextDisplay has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                          _controlFailureTextDisplay: function(item, response) {
                              var mode, maxChars, responseProperty, failureReason, shortFailureReason;
                      
                              mode = this._options.failedUploadTextDisplay.mode;
                              maxChars = this._options.failedUploadTextDisplay.maxChars;
                      Severity: Minor
                      Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.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 _setupDragDrop has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          _setupDragDrop: function(){
                              var self, dropArea;
                      
                              self = this;
                      
                      
                      Severity: Minor
                      Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js - About 1 hr to fix

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

                        qq.extend = function (first, second, extendNested) {
                            "use strict";
                            var prop;
                            for (prop in second) {
                                if (second.hasOwnProperty(prop)) {
                        Severity: Minor
                        Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.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 _upload has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            _upload: function(id, params){
                                this._options.onUpload(id, this.getName(id), false);
                                var input = this._inputs[id];
                        
                                if (!input){
                        Severity: Minor
                        Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js - About 1 hr to fix

                          Function _setupDropzone has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              _setupDropzone: function(dropArea){
                                  var self = this;
                          
                                  var dz = new qq.UploadDropZone({
                                      element: dropArea,
                          Severity: Minor
                          Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js - About 1 hr to fix

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

                                _attachEvents: function(){
                                    var self = this;
                            
                                    self._attach(self._element, 'dragover', function(e){
                                        if (!self._isValidFileDrag(e)) return;
                            Severity: Minor
                            Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js - About 1 hr to fix

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

                              qq.log = function(message, level) {
                                  // -start- add logger
                                  if (App && App.Log) {
                                    App.Log.debug(this._name, arguments)
                                  }
                              Severity: Minor
                              Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.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 _onComplete has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  _onComplete: function(id, fileName, result, xhr){
                                      qq.FineUploaderBasic.prototype._onComplete.apply(this, arguments);
                              
                                      var item = this.getItemByFileId(id);
                              
                              
                              Severity: Minor
                              Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.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 _onComplete has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  _onComplete: function(id, fileName, result, xhr){
                                      qq.FineUploaderBasic.prototype._onComplete.apply(this, arguments);
                              
                                      var item = this.getItemByFileId(id);
                              
                              
                              Severity: Minor
                              Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js - About 1 hr to fix

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

                                    _controlFailureTextDisplay: function(item, response) {
                                        var mode, maxChars, responseProperty, failureReason, shortFailureReason;
                                
                                        mode = this._options.failedUploadTextDisplay.mode;
                                        maxChars = this._options.failedUploadTextDisplay.maxChars;
                                Severity: Minor
                                Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js - About 1 hr to fix

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

                                      _disableDropOutside: function(e){
                                          // run only once for all instances
                                          if (!qq.UploadDropZone.dropOutsideDisabled ){
                                  
                                              // for these cases we need to catch onDrop to reset dropArea
                                  Severity: Minor
                                  Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.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 (this._options.validation.stopOnFirstInvalidFile){
                                                              return;
                                                          }
                                  Severity: Major
                                  Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js - About 45 mins to fix

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

                                        _upload: function(id, params){
                                            this._options.onUpload(id, this.getName(id), true);
                                    
                                            var file = this._files[id],
                                                name = this.getName(id),
                                    Severity: Minor
                                    Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.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

                                    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/app/lib/base/jquery.fineuploader-3.0.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 _maybeParseAndSendUploadError has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        _maybeParseAndSendUploadError: function(id, fileName, response, xhr) {
                                            //assuming no one will actually set the response code to something other than 200 and still set 'success' to true
                                            if (!response.success){
                                                if (xhr && xhr.status !== 200 && !response.error) {
                                                    this._options.callbacks.onError(id, fileName, "XHR returned response code " + xhr.status);
                                    Severity: Minor
                                    Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.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 _onComplete has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        _onComplete: function(id, xhr){
                                            "use strict";
                                            // the request was aborted/cancelled
                                            if (!this._files[id]) { return; }
                                    
                                    
                                    Severity: Minor
                                    Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.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/app/lib/base/jquery.fineuploader-3.0.js - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                              return true;
                                      Severity: Major
                                      Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js - About 30 mins to fix

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

                                            _setupDropzone: function(dropArea){
                                                var self = this;
                                        
                                                var dz = new qq.UploadDropZone({
                                                    element: dropArea,
                                        Severity: Minor
                                        Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.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

                                                    if (this._classes.successIcon) {
                                                        this._find(item, 'finished').style.display = "inline-block";
                                                        qq(item).addClass(this._classes.successIcon);
                                                    }
                                        app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js on lines 1234..1237

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

                                        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._classes.failIcon) {
                                                        this._find(item, 'finished').style.display = "inline-block";
                                                        qq(item).addClass(this._classes.failIcon);
                                                    }
                                        app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js on lines 1228..1231

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

                                        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 3 locations. Consider refactoring.
                                        Open

                                                    if (element.removeEventListener){
                                                        element.removeEventListener(type, fn, false);
                                                    } else if (element.attachEvent){
                                                        element.detachEvent('on' + type, fn);
                                                    }
                                        Severity: Major
                                        Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js and 2 other locations - About 50 mins to fix
                                        app/assets/javascripts/app/lib/base/exif.js on lines 307..311
                                        app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js on lines 24..28

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

                                        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 3 locations. Consider refactoring.
                                        Open

                                                    if (element.addEventListener){
                                                        element.addEventListener(type, fn, false);
                                                    } else if (element.attachEvent){
                                                        element.attachEvent('on' + type, fn);
                                                    }
                                        Severity: Major
                                        Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js and 2 other locations - About 50 mins to fix
                                        app/assets/javascripts/app/lib/base/exif.js on lines 307..311
                                        app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js on lines 35..39

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

                                        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

                                        qq.chrome   = function(){ return navigator.vendor != undefined && navigator.vendor.indexOf('Google') != -1; }
                                        Severity: Minor
                                        Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js and 1 other location - About 40 mins to fix
                                        app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js on lines 220..220

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

                                        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

                                        qq.safari   = function(){ return navigator.vendor != undefined && navigator.vendor.indexOf("Apple") != -1; }
                                        Severity: Minor
                                        Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js and 1 other location - About 40 mins to fix
                                        app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js on lines 221..221

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

                                        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 (self._options.dragAndDrop.hideDropzones) {
                                                        for (i=0; i < dropzones.length; i++) {
                                                            qq(dropzones[i]).hide();
                                                        }
                                                    }
                                        Severity: Minor
                                        Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js and 1 other location - About 35 mins to fix
                                        app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js on lines 1158..1162

                                        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

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

                                                    if (self._options.dragAndDrop.hideDropzones && qq.FineUploader.prototype._leaving_document_out(e)) {
                                                        for (i=0; i < dropzones.length; i++) {
                                                            qq(dropzones[i]).hide();
                                                        }
                                                    }
                                        Severity: Minor
                                        Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js and 1 other location - About 35 mins to fix
                                        app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js on lines 1165..1169

                                        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 (!file.value){
                                                    // fix missing properties in Safari 4 and firefox 11.0a2
                                                    size = (file.fileSize !== null && file.fileSize !== undefined) ? file.fileSize : file.size;
                                                }
                                        Severity: Minor
                                        Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js and 1 other location - About 35 mins to fix
                                        app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js on lines 879..882

                                        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

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

                                                } else {
                                                    // fix missing properties in Safari 4 and firefox 11.0a2
                                                    name = (file.fileName !== null && file.fileName !== undefined) ? file.fileName : file.name;
                                                }
                                        Severity: Minor
                                        Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js and 1 other location - About 35 mins to fix
                                        app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js on lines 889..892

                                        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

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

                                                this._attach(input, 'focus', function(){
                                                    qq(self._element).addClass(self._options.focusClass);
                                                });
                                        Severity: Minor
                                        Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js and 2 other locations - About 30 mins to fix
                                        app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js on lines 416..418
                                        app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js on lines 419..421

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

                                        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 3 locations. Consider refactoring.
                                        Open

                                                this._attach(input, 'mouseout', function(){
                                                    qq(self._element).removeClass(self._options.hoverClass);
                                                });
                                        Severity: Minor
                                        Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js and 2 other locations - About 30 mins to fix
                                        app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js on lines 416..418
                                        app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js on lines 422..424

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

                                        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 3 locations. Consider refactoring.
                                        Open

                                                this._attach(input, 'mouseover', function(){
                                                    qq(self._element).addClass(self._options.hoverClass);
                                                });
                                        Severity: Minor
                                        Found in app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js and 2 other locations - About 30 mins to fix
                                        app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js on lines 419..421
                                        app/assets/javascripts/app/lib/base/jquery.fineuploader-3.0.js on lines 422..424

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

                                        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