TTLabs/EvaporateJS

View on GitHub

Showing 22 of 51 total issues

File evaporate.js has 1897 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*Copyright (c) 2016, TT Labs, Inc.
 All rights reserved.

 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Severity: Major
Found in evaporate.js - About 5 days to fix

    Function signingVersion has 192 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function signingVersion(awsRequest, l) {
        var con = awsRequest.con;
        function AwsSignature(request) {
          this.request = request;
        }
    Severity: Major
    Found in evaporate.js - About 7 hrs to fix

      Function authorizationMethod has 89 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function authorizationMethod(awsRequest) {
          var fileUpload = awsRequest.fileUpload,
              con = fileUpload.con,
              request = awsRequest.request;
      
      
      Severity: Major
      Found in evaporate.js - About 3 hrs to fix

        Function Evaporate has 66 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          var Evaporate = function (config) {
            this.config = extend({
              readableStreams: false,
              readableStreamPartMethod: null,
              bucket: null,
        Severity: Major
        Found in evaporate.js - About 2 hrs to fix

          Function add has 59 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            Evaporate.prototype.add = function (file,  pConfig) {
              var self = this,
                  fileConfig;
              return new Promise(function (resolve, reject) {
                var c = extend(pConfig, {});
          Severity: Major
          Found in evaporate.js - About 2 hrs to fix

            Function sendRequestToAWS has 56 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              SignedS3AWSRequest.prototype.sendRequestToAWS = function () {
                var self = this;
                return new Promise( function (resolve, reject) {
                  var xhr = new XMLHttpRequest();
                  self.currentXhr = xhr;
            Severity: Major
            Found in evaporate.js - About 2 hrs to fix

              Function canonicalHeaders has 47 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  AwsSignatureV4.prototype.canonicalHeaders = function () {
                    var canonicalHeaders = [],
                        keys = [],
                        i;
              
              
              Severity: Minor
              Found in evaporate.js - About 1 hr to fix

                Function authorize has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    AuthorizationMethod.prototype.authorize = function () {
                      return new Promise(function (resolve, reject) {
                        var xhr = new XMLHttpRequest();
                        awsRequest.currentXhr = xhr;
                
                
                Severity: Minor
                Found in evaporate.js - About 1 hr to fix

                  Function validateEvaporateOptions has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    Evaporate.prototype.validateEvaporateOptions = function () {
                      this.supported = !(
                      typeof File === 'undefined' ||
                      typeof Promise === 'undefined');
                  
                  
                  Severity: Minor
                  Found in evaporate.js - About 1 hr to fix

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

                      FileUpload.prototype.makeParts = function (firstPart) {
                        this.numParts = Math.ceil(this.sizeBytes / this.con.partSize) || 1; // issue #58
                        var partsDeferredPromises = [];
                    
                        var self = this;
                    Severity: Minor
                    Found in evaporate.js - About 1 hr to fix

                      Function streamToArrayBuffer has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        PutPart.prototype.streamToArrayBuffer = function (stream) {
                          return new Promise(function (resolve, reject) {
                            // stream is empty or ended
                            if (!stream.readable) { return resolve([]); }
                      
                      
                      Severity: Minor
                      Found in evaporate.js - About 1 hr to fix

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

                          FileUpload.prototype.consumeSlots = function () {
                            if (this.partsToUpload.length === 0) { return -1 }
                            if (this.partsToUpload.length !== this.partsInProcess.length &&
                                this.status === EVAPORATING) {
                        
                        
                        Severity: Minor
                        Found in evaporate.js - About 1 hr to fix

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

                            FileUpload.prototype.progessStats = function () {
                              // Adapted from https://github.com/fkjaekel
                              // https://github.com/TTLabs/EvaporateJS/issues/13
                              if (this.fileTotalBytesUploaded === 0) {
                                return {
                          Severity: Minor
                          Found in evaporate.js - About 1 hr to fix

                            Function canonicalQueryString has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                AwsSignatureV4.prototype.canonicalQueryString = function () {
                                  var qs = awsRequest.request.query_string || '',
                                      search = uri([awsRequest.awsUrl, this.request.path, qs].join("")).search,
                                      searchParts = search.length ? search.split('&') : [],
                                      encoded = [],
                            Severity: Minor
                            Found in evaporate.js - About 1 hr to fix

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

                                Evaporate.getLocalTimeOffset = function (config) {
                                  return new Promise(function (resolve, reject) {
                                    if (typeof config.localTimeOffset === 'number') {
                                      return resolve(config.localTimeOffset);
                                    }
                              Severity: Minor
                              Found in evaporate.js - About 1 hr to fix

                                Method getSignatureKey has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    static byte[] getSignatureKey(String secretKey, String dateStamp, String regionName, String serviceName, String toSign) throws Exception {
                                Severity: Minor
                                Found in example/SignerV4Example.java - About 35 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                          return 'The browser\'s FileReader object does not support readAsArrayBuffer';
                                  Severity: Major
                                  Found in evaporate.js - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                          return 'Option awsSignatureVersion is 4 but computeContentMd5 is not enabled.';
                                    Severity: Major
                                    Found in evaporate.js - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                              return 'Option computeContentMd5 has been set but cryptoMd5Method is not defined.'
                                      Severity: Major
                                      Found in evaporate.js - About 30 mins to fix

                                        Avoid too many return statements within this function.
                                        Open

                                              return "The AWS 'bucket' option must be present.";
                                        Severity: Major
                                        Found in evaporate.js - About 30 mins to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language