flowjs/flow.js

View on GitHub
samples/java/web/resumable.js

Summary

Maintainability
F
4 days
Test Coverage

File resumable.js has 747 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Generated by CoffeeScript 1.6.1
(function() {
  var Resumable, ResumableChunk, ResumableFile,
    __slice = [].slice,
    __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
Severity: Major
Found in samples/java/web/resumable.js - About 1 day to fix

    Function send has 112 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        ResumableChunk.prototype.send = function() {
          var bytes, customQuery, data, doneHandler, func, headers, key, params, preprocess, progressHandler, query, ret, target, value,
            _this = this;
          preprocess = this.getOpt('preprocess');
          if (typeof preprocess === 'function') {
    Severity: Major
    Found in samples/java/web/resumable.js - About 4 hrs to fix

      Function uploadNextChunk has 62 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          Resumable.prototype.uploadNextChunk = function() {
            var chunk, file, found, outstanding, status, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref, _ref1, _ref2, _ref3, _ref4;
            console.log("uploadNextChunk");
            found = false;
            if (this.getOpt('prioritizeFirstAndLastChunk')) {
      Severity: Major
      Found in samples/java/web/resumable.js - About 2 hrs to fix

        Function test has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            ResumableChunk.prototype.test = function() {
              var customQuery, headers, key, params, testHandler, value,
                _this = this;
              this.xhr = new XMLHttpRequest();
              testHandler = function(e) {
        Severity: Minor
        Found in samples/java/web/resumable.js - About 1 hr to fix

          Function Resumable has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function Resumable(opt) {
                this.opt = opt;
                console.log('constructor');
                this.support = (typeof File !== "undefined" && File !== null) && (typeof Blob !== "undefined" && Blob !== null) && (typeof FileList !== "undefined" && FileList !== null) && ((Blob.prototype.webkitSlice != null) || (Blob.prototype.mozSlice != null) || (Blob.prototype.slice != null));
                this.files = [];
          Severity: Minor
          Found in samples/java/web/resumable.js - About 1 hr to fix

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

                Resumable.prototype.assignBrowse = function(domNodes, isDirectory) {
                  var changeHandler, dn, input, maxFiles, _i, _len,
                    _this = this;
                  console.log("assignBrowse");
                  if (domNodes.length == null) {
            Severity: Minor
            Found in samples/java/web/resumable.js - About 1 hr to fix

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

                  Resumable.prototype.appendFilesFromFileList = function(fileList, event) {
                    var errorCount, file, files, maxFileSize, maxFileSizeErrorCallback, maxFiles, maxFilesErrorCallback, minFileSize, minFileSizeErrorCallback, resumableFile, _i, _len, _ref;
                    console.log("appendFilesFromFileList");
                    errorCount = 0;
                    _ref = this.getOpt(['maxFiles', 'minFileSize', 'maxFileSize', 'maxFilesErrorCallback', 'minFileSizeErrorCallback', 'maxFileSizeErrorCallback']), maxFiles = _ref[0], minFileSize = _ref[1], maxFileSize = _ref[2], maxFilesErrorCallback = _ref[3], minFileSizeErrorCallback = _ref[4], maxFileSizeErrorCallback = _ref[5];
              Severity: Minor
              Found in samples/java/web/resumable.js - About 1 hr to fix

                Avoid too many return statements within this function.
                Open

                        return 'pending';
                Severity: Major
                Found in samples/java/web/resumable.js - About 30 mins to fix

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

                      Resumable.prototype.cancel = function() {
                        var file, _i, _len, _ref;
                        console.log("cancel");
                        _ref = this.files;
                        for (_i = 0, _len = _ref.length; _i < _len; _i++) {
                  Severity: Major
                  Found in samples/java/web/resumable.js and 1 other location - About 4 hrs to fix
                  samples/java/web/resumable.js on lines 347..356

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

                  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

                      Resumable.prototype.pause = function() {
                        var file, _i, _len, _ref;
                        console.log("pause");
                        _ref = this.files;
                        for (_i = 0, _len = _ref.length; _i < _len; _i++) {
                  Severity: Major
                  Found in samples/java/web/resumable.js and 1 other location - About 4 hrs to fix
                  samples/java/web/resumable.js on lines 358..367

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

                  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

                          minFileSizeErrorCallback: function(file, errorCount) {
                            return alert(file.fileName(+' is too small, please upload files larger than ' + this.formatSize(this.getOpt('minFileSize')) + '.'));
                          },
                  Severity: Minor
                  Found in samples/java/web/resumable.js and 1 other location - About 55 mins to fix
                  samples/java/web/resumable.js on lines 44..46

                  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

                          maxFileSizeErrorCallback: function(file, errorCount) {
                            return alert(file.fileName(+' is too large, please upload files less than ' + this.formatSize(this.getOpt('maxFileSize')) + '.'));
                          }
                  Severity: Minor
                  Found in samples/java/web/resumable.js and 1 other location - About 55 mins to fix
                  samples/java/web/resumable.js on lines 40..42

                  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

                  There are no issues that match your filters.

                  Category
                  Status