jkuchar/MultipleFileUpload

View on GitHub
public/swfupload/js/handlers.js

Summary

Maintainability
D
2 days
Test Coverage

Function uploadError has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            uploadError: function(event, file, errorCode, message) {
                    try {
                            var progress = new FileProgress(file, $(this).swfuInstance().customSettings.progressTarget);
                            progress.setError();
                            progress.toggleCancel(false);
Severity: Minor
Found in public/swfupload/js/handlers.js - About 1 hr to fix

    Function fileQueueError has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                fileQueueError: function(event, file, errorCode, message) {
                        try {
                                if (errorCode === SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED) {
                                        alert("You have attempted to queue too many files.\n" + (message === 0 ? "You have reached the upload limit." : "You may select " + (message > 1 ? "up to " + message + " files." : "one file.")));
                                        return;
    Severity: Minor
    Found in public/swfupload/js/handlers.js - About 1 hr to fix

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

                                  case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:
                                          progress.setStatus("File is too big.");
                                          $(this).swfuInstance().debug("Error Code: File too big, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
                                          break;
      Severity: Major
      Found in public/swfupload/js/handlers.js and 5 other locations - About 1 hr to fix
      public/swfupload/js/handlers.js on lines 71..74
      public/swfupload/js/handlers.js on lines 75..78
      public/swfupload/js/handlers.js on lines 154..157
      public/swfupload/js/handlers.js on lines 166..169
      public/swfupload/js/handlers.js on lines 170..173

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

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

                                  case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:
                                          progress.setStatus("Failed Validation.  Upload skipped.");
                                          $(this).swfuInstance().debug("Error Code: File Validation Failed, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
                                          break;
      Severity: Major
      Found in public/swfupload/js/handlers.js and 5 other locations - About 1 hr to fix
      public/swfupload/js/handlers.js on lines 67..70
      public/swfupload/js/handlers.js on lines 71..74
      public/swfupload/js/handlers.js on lines 75..78
      public/swfupload/js/handlers.js on lines 154..157
      public/swfupload/js/handlers.js on lines 166..169

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

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

                                  case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:
                                          progress.setStatus("Invalid File Type.");
                                          $(this).swfuInstance().debug("Error Code: Invalid File Type, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
                                          break;
      Severity: Major
      Found in public/swfupload/js/handlers.js and 5 other locations - About 1 hr to fix
      public/swfupload/js/handlers.js on lines 67..70
      public/swfupload/js/handlers.js on lines 71..74
      public/swfupload/js/handlers.js on lines 154..157
      public/swfupload/js/handlers.js on lines 166..169
      public/swfupload/js/handlers.js on lines 170..173

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

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

                                  case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:
                                          progress.setStatus("Cannot upload Zero Byte files.");
                                          $(this).swfuInstance().debug("Error Code: Zero byte file, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
                                          break;
      Severity: Major
      Found in public/swfupload/js/handlers.js and 5 other locations - About 1 hr to fix
      public/swfupload/js/handlers.js on lines 67..70
      public/swfupload/js/handlers.js on lines 75..78
      public/swfupload/js/handlers.js on lines 154..157
      public/swfupload/js/handlers.js on lines 166..169
      public/swfupload/js/handlers.js on lines 170..173

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

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

                                  case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:
                                          progress.setStatus("Upload Failed.");
                                          $(this).swfuInstance().debug("Error Code: Upload Failed, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
                                          break;
      Severity: Major
      Found in public/swfupload/js/handlers.js and 5 other locations - About 1 hr to fix
      public/swfupload/js/handlers.js on lines 67..70
      public/swfupload/js/handlers.js on lines 71..74
      public/swfupload/js/handlers.js on lines 75..78
      public/swfupload/js/handlers.js on lines 166..169
      public/swfupload/js/handlers.js on lines 170..173

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

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

                                  case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:
                                          progress.setStatus("Upload limit exceeded.");
                                          $(this).swfuInstance().debug("Error Code: Upload Limit Exceeded, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
                                          break;
      Severity: Major
      Found in public/swfupload/js/handlers.js and 5 other locations - About 1 hr to fix
      public/swfupload/js/handlers.js on lines 67..70
      public/swfupload/js/handlers.js on lines 71..74
      public/swfupload/js/handlers.js on lines 75..78
      public/swfupload/js/handlers.js on lines 154..157
      public/swfupload/js/handlers.js on lines 170..173

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

      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

                                  case SWFUpload.UPLOAD_ERROR.IO_ERROR:
                                          progress.setStatus("Server (IO) Error");
                                          $(this).swfuInstance().debug("Error Code: IO Error, File name: " + file.name + ", Message: " + message);
                                          break;
      Severity: Major
      Found in public/swfupload/js/handlers.js and 1 other location - About 1 hr to fix
      public/swfupload/js/handlers.js on lines 162..165

      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

                                  case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:
                                          progress.setStatus("Security Error");
                                          $(this).swfuInstance().debug("Error Code: Security Error, File name: " + file.name + ", Message: " + message);
                                          break;
      Severity: Major
      Found in public/swfupload/js/handlers.js and 1 other location - About 1 hr to fix
      public/swfupload/js/handlers.js on lines 158..161

      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

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

                                          $(this).swfuInstance().debug("Error Code: " + errorCode + ", File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
      Severity: Major
      Found in public/swfupload/js/handlers.js and 1 other location - About 1 hr to fix
      public/swfupload/js/handlers.js on lines 188..188

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

      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

                                          $(this).swfuInstance().debug("Error Code: " + errorCode + ", File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
      Severity: Major
      Found in public/swfupload/js/handlers.js and 1 other location - About 1 hr to fix
      public/swfupload/js/handlers.js on lines 83..83

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

      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 ($(this).swfuInstance().getStats().files_queued === 0) {
                                      var buttonId = $(this).swfuInstance().customSettings.cancelButtonId;
                                      $('#'+buttonId).attr("disabled", true);
                                  }
      Severity: Major
      Found in public/swfupload/js/handlers.js and 2 other locations - About 45 mins to fix
      public/swfupload/js/handlers.js on lines 93..96
      public/swfupload/js/handlers.js on lines 176..179

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

      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 (numFilesSelected > 0) {
                                          var buttonId = $(this).swfuInstance().customSettings.cancelButtonId
                                          $('#'+buttonId).attr("disabled", false);
                                  }
      Severity: Major
      Found in public/swfupload/js/handlers.js and 2 other locations - About 45 mins to fix
      public/swfupload/js/handlers.js on lines 176..179
      public/swfupload/js/handlers.js on lines 198..201

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

      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 ($(this).swfuInstance().getStats().files_queued === 0) {
                                                  var buttonId = $(this).swfuInstance().customSettings.cancelButtonId
                                                  $('#'+buttonId).attr("disabled", true);
                                          }
      Severity: Major
      Found in public/swfupload/js/handlers.js and 2 other locations - About 45 mins to fix
      public/swfupload/js/handlers.js on lines 93..96
      public/swfupload/js/handlers.js on lines 198..201

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

      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