flowjs/flow.js

View on GitHub

Showing 38 of 38 total issues

File flow.js has 918 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * @license MIT
 */
(function(window, document, undefined) {'use strict';
  if (!window || !document) {
Severity: Major
Found in src/flow.js - About 2 days to fix

    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 exports has 113 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = function(grunt) {
        // Project configuration.
        grunt.initConfig({
          pkg: grunt.file.readJSON('package.json'),
          uglify: {
      Severity: Major
      Found in Gruntfile.js - About 4 hrs 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

          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

          Function exports has 104 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = function(config) {
            // define SL browsers
            var customLaunchers = {
              sl_ie10: {
                base: 'SauceLabs',
          Severity: Major
          Found in karma.conf.js - About 4 hrs to fix

            Function FlowChunk has 71 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function FlowChunk(flowObj, fileObj, offset) {
            
                /**
                 * Reference to parent flow object
                 * @type {Flow}
            Severity: Major
            Found in src/flow.js - About 2 hrs to fix

              Function Flow has 67 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                function Flow(opts) {
                  /**
                   * Supported by browser?
                   * @type {boolean}
                   */
              Severity: Major
              Found in src/flow.js - About 2 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 uploadNextChunk has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      uploadNextChunk: function (preventEvents) {
                        // In some cases (such as videos) it's really handy to upload the first
                        // and last chunk of a file quickly; this let's the server check the file's
                        // metadata and determine if there's even a point in continuing.
                        var found = false;
                  Severity: Minor
                  Found in src/flow.js - About 2 hrs to fix

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

                        webkitReadDataTransfer: function (event) {
                          var $ = this;
                          var queue = event.dataTransfer.items.length;
                          var files = [];
                          each(event.dataTransfer.items, function (item) {
                    Severity: Minor
                    Found in src/flow.js - About 1 hr 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 send has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              send: function () {
                                var preprocess = this.flowObj.opts.preprocess;
                                var read = this.flowObj.opts.readFileFn;
                                if (typeof preprocess === 'function') {
                                  switch (this.preprocessState) {
                          Severity: Minor
                          Found in src/flow.js - About 1 hr to fix

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

                                assignBrowse: function (domNodes, isDirectory, singleFile, attributes) {
                                  if (domNodes instanceof Element) {
                                    domNodes = [domNodes];
                                  }
                            
                            
                            Severity: Minor
                            Found in src/flow.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 post has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    $.post = function(req, callback) {
                                
                                        var fields = req.body;
                                        var files = req.files;
                                
                                
                                Severity: Minor
                                Found in samples/Node.js/flow-node.js - About 1 hr to fix

                                  Function chunkEvent has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      chunkEvent: function (chunk, event, message) {
                                        switch (event) {
                                          case 'progress':
                                            if (Date.now() - this._lastProgressCallback <
                                              this.flowObj.opts.progressCallbacksInterval) {
                                  Severity: Minor
                                  Found in src/flow.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
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language