TTLabs/EvaporateJS

View on GitHub

Showing 51 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 has a complexity of 17.
        Open

          Evaporate.prototype.validateEvaporateOptions = function () {
        Severity: Minor
        Found in evaporate.js by eslint

        Limit Cyclomatic Complexity (complexity)

        Cyclomatic complexity measures the number of linearly independent paths through a program's source code. This rule allows setting a cyclomatic complexity threshold.

        function a(x) {
            if (true) {
                return x; // 1st path
            } else if (false) {
                return x+1; // 2nd path
            } else {
                return 4; // 3rd path
            }
        }

        Rule Details

        This rule is aimed at reducing code complexity by capping the amount of cyclomatic complexity allowed in a program. As such, it will warn when the cyclomatic complexity crosses the configured threshold (default is 20).

        Examples of incorrect code for a maximum of 2:

        /*eslint complexity: ["error", 2]*/
        
        function a(x) {
            if (true) {
                return x;
            } else if (false) {
                return x+1;
            } else {
                return 4; // 3rd path
            }
        }

        Examples of correct code for a maximum of 2:

        /*eslint complexity: ["error", 2]*/
        
        function a(x) {
            if (true) {
                return x;
            } else {
                return 4;
            }
        }

        Options

        Optionally, you may specify a max object property:

        "complexity": ["error", 2]

        is equivalent to

        "complexity": ["error", { "max": 2 }]

        Deprecated: the object property maximum is deprecated. Please use the property max instead.

        When Not To Use It

        If you can't determine an appropriate complexity limit for your code, then it's best to disable this rule.

        Further Reading

        Related Rules

        • [max-depth](max-depth.md)
        • [max-len](max-len.md)
        • [max-nested-callbacks](max-nested-callbacks.md)
        • [max-params](max-params.md)
        • [max-statements](max-statements.md) Source: http://eslint.org/docs/rules/

        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 has a complexity of 11.
            Open

                AwsSignatureV4.prototype.canonicalHeaders = function () {
            Severity: Minor
            Found in evaporate.js by eslint

            Limit Cyclomatic Complexity (complexity)

            Cyclomatic complexity measures the number of linearly independent paths through a program's source code. This rule allows setting a cyclomatic complexity threshold.

            function a(x) {
                if (true) {
                    return x; // 1st path
                } else if (false) {
                    return x+1; // 2nd path
                } else {
                    return 4; // 3rd path
                }
            }

            Rule Details

            This rule is aimed at reducing code complexity by capping the amount of cyclomatic complexity allowed in a program. As such, it will warn when the cyclomatic complexity crosses the configured threshold (default is 20).

            Examples of incorrect code for a maximum of 2:

            /*eslint complexity: ["error", 2]*/
            
            function a(x) {
                if (true) {
                    return x;
                } else if (false) {
                    return x+1;
                } else {
                    return 4; // 3rd path
                }
            }

            Examples of correct code for a maximum of 2:

            /*eslint complexity: ["error", 2]*/
            
            function a(x) {
                if (true) {
                    return x;
                } else {
                    return 4;
                }
            }

            Options

            Optionally, you may specify a max object property:

            "complexity": ["error", 2]

            is equivalent to

            "complexity": ["error", { "max": 2 }]

            Deprecated: the object property maximum is deprecated. Please use the property max instead.

            When Not To Use It

            If you can't determine an appropriate complexity limit for your code, then it's best to disable this rule.

            Further Reading

            Related Rules

            • [max-depth](max-depth.md)
            • [max-len](max-len.md)
            • [max-nested-callbacks](max-nested-callbacks.md)
            • [max-params](max-params.md)
            • [max-statements](max-statements.md) Source: http://eslint.org/docs/rules/

            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 has a complexity of 10.
              Open

                FileUpload.prototype.consumeSlots = function () {
              Severity: Minor
              Found in evaporate.js by eslint

              Limit Cyclomatic Complexity (complexity)

              Cyclomatic complexity measures the number of linearly independent paths through a program's source code. This rule allows setting a cyclomatic complexity threshold.

              function a(x) {
                  if (true) {
                      return x; // 1st path
                  } else if (false) {
                      return x+1; // 2nd path
                  } else {
                      return 4; // 3rd path
                  }
              }

              Rule Details

              This rule is aimed at reducing code complexity by capping the amount of cyclomatic complexity allowed in a program. As such, it will warn when the cyclomatic complexity crosses the configured threshold (default is 20).

              Examples of incorrect code for a maximum of 2:

              /*eslint complexity: ["error", 2]*/
              
              function a(x) {
                  if (true) {
                      return x;
                  } else if (false) {
                      return x+1;
                  } else {
                      return 4; // 3rd path
                  }
              }

              Examples of correct code for a maximum of 2:

              /*eslint complexity: ["error", 2]*/
              
              function a(x) {
                  if (true) {
                      return x;
                  } else {
                      return 4;
                  }
              }

              Options

              Optionally, you may specify a max object property:

              "complexity": ["error", 2]

              is equivalent to

              "complexity": ["error", { "max": 2 }]

              Deprecated: the object property maximum is deprecated. Please use the property max instead.

              When Not To Use It

              If you can't determine an appropriate complexity limit for your code, then it's best to disable this rule.

              Further Reading

              Related Rules

              • [max-depth](max-depth.md)
              • [max-len](max-len.md)
              • [max-nested-callbacks](max-nested-callbacks.md)
              • [max-params](max-params.md)
              • [max-statements](max-statements.md) Source: http://eslint.org/docs/rules/

              Function has a complexity of 8.
              Open

                var Evaporate = function (config) {
              Severity: Minor
              Found in evaporate.js by eslint

              Limit Cyclomatic Complexity (complexity)

              Cyclomatic complexity measures the number of linearly independent paths through a program's source code. This rule allows setting a cyclomatic complexity threshold.

              function a(x) {
                  if (true) {
                      return x; // 1st path
                  } else if (false) {
                      return x+1; // 2nd path
                  } else {
                      return 4; // 3rd path
                  }
              }

              Rule Details

              This rule is aimed at reducing code complexity by capping the amount of cyclomatic complexity allowed in a program. As such, it will warn when the cyclomatic complexity crosses the configured threshold (default is 20).

              Examples of incorrect code for a maximum of 2:

              /*eslint complexity: ["error", 2]*/
              
              function a(x) {
                  if (true) {
                      return x;
                  } else if (false) {
                      return x+1;
                  } else {
                      return 4; // 3rd path
                  }
              }

              Examples of correct code for a maximum of 2:

              /*eslint complexity: ["error", 2]*/
              
              function a(x) {
                  if (true) {
                      return x;
                  } else {
                      return 4;
                  }
              }

              Options

              Optionally, you may specify a max object property:

              "complexity": ["error", 2]

              is equivalent to

              "complexity": ["error", { "max": 2 }]

              Deprecated: the object property maximum is deprecated. Please use the property max instead.

              When Not To Use It

              If you can't determine an appropriate complexity limit for your code, then it's best to disable this rule.

              Further Reading

              Related Rules

              • [max-depth](max-depth.md)
              • [max-len](max-len.md)
              • [max-nested-callbacks](max-nested-callbacks.md)
              • [max-params](max-params.md)
              • [max-statements](max-statements.md) Source: http://eslint.org/docs/rules/

              Function has a complexity of 8.
              Open

                    return new Promise(function (resolve, reject) {
              Severity: Minor
              Found in evaporate.js by eslint

              Limit Cyclomatic Complexity (complexity)

              Cyclomatic complexity measures the number of linearly independent paths through a program's source code. This rule allows setting a cyclomatic complexity threshold.

              function a(x) {
                  if (true) {
                      return x; // 1st path
                  } else if (false) {
                      return x+1; // 2nd path
                  } else {
                      return 4; // 3rd path
                  }
              }

              Rule Details

              This rule is aimed at reducing code complexity by capping the amount of cyclomatic complexity allowed in a program. As such, it will warn when the cyclomatic complexity crosses the configured threshold (default is 20).

              Examples of incorrect code for a maximum of 2:

              /*eslint complexity: ["error", 2]*/
              
              function a(x) {
                  if (true) {
                      return x;
                  } else if (false) {
                      return x+1;
                  } else {
                      return 4; // 3rd path
                  }
              }

              Examples of correct code for a maximum of 2:

              /*eslint complexity: ["error", 2]*/
              
              function a(x) {
                  if (true) {
                      return x;
                  } else {
                      return 4;
                  }
              }

              Options

              Optionally, you may specify a max object property:

              "complexity": ["error", 2]

              is equivalent to

              "complexity": ["error", { "max": 2 }]

              Deprecated: the object property maximum is deprecated. Please use the property max instead.

              When Not To Use It

              If you can't determine an appropriate complexity limit for your code, then it's best to disable this rule.

              Further Reading

              Related Rules

              • [max-depth](max-depth.md)
              • [max-len](max-len.md)
              • [max-nested-callbacks](max-nested-callbacks.md)
              • [max-params](max-params.md)
              • [max-statements](max-statements.md) Source: http://eslint.org/docs/rules/

              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 'getSavedUploads' has a complexity of 7.
                  Open

                    function getSavedUploads(purge) {
                  Severity: Minor
                  Found in evaporate.js by eslint

                  Limit Cyclomatic Complexity (complexity)

                  Cyclomatic complexity measures the number of linearly independent paths through a program's source code. This rule allows setting a cyclomatic complexity threshold.

                  function a(x) {
                      if (true) {
                          return x; // 1st path
                      } else if (false) {
                          return x+1; // 2nd path
                      } else {
                          return 4; // 3rd path
                      }
                  }

                  Rule Details

                  This rule is aimed at reducing code complexity by capping the amount of cyclomatic complexity allowed in a program. As such, it will warn when the cyclomatic complexity crosses the configured threshold (default is 20).

                  Examples of incorrect code for a maximum of 2:

                  /*eslint complexity: ["error", 2]*/
                  
                  function a(x) {
                      if (true) {
                          return x;
                      } else if (false) {
                          return x+1;
                      } else {
                          return 4; // 3rd path
                      }
                  }

                  Examples of correct code for a maximum of 2:

                  /*eslint complexity: ["error", 2]*/
                  
                  function a(x) {
                      if (true) {
                          return x;
                      } else {
                          return 4;
                      }
                  }

                  Options

                  Optionally, you may specify a max object property:

                  "complexity": ["error", 2]

                  is equivalent to

                  "complexity": ["error", { "max": 2 }]

                  Deprecated: the object property maximum is deprecated. Please use the property max instead.

                  When Not To Use It

                  If you can't determine an appropriate complexity limit for your code, then it's best to disable this rule.

                  Further Reading

                  Related Rules

                  • [max-depth](max-depth.md)
                  • [max-len](max-len.md)
                  • [max-nested-callbacks](max-nested-callbacks.md)
                  • [max-params](max-params.md)
                  • [max-statements](max-statements.md) Source: http://eslint.org/docs/rules/

                  Function has a complexity of 7.
                  Open

                      return new Promise( function (resolve, reject) {
                  Severity: Minor
                  Found in evaporate.js by eslint

                  Limit Cyclomatic Complexity (complexity)

                  Cyclomatic complexity measures the number of linearly independent paths through a program's source code. This rule allows setting a cyclomatic complexity threshold.

                  function a(x) {
                      if (true) {
                          return x; // 1st path
                      } else if (false) {
                          return x+1; // 2nd path
                      } else {
                          return 4; // 3rd path
                      }
                  }

                  Rule Details

                  This rule is aimed at reducing code complexity by capping the amount of cyclomatic complexity allowed in a program. As such, it will warn when the cyclomatic complexity crosses the configured threshold (default is 20).

                  Examples of incorrect code for a maximum of 2:

                  /*eslint complexity: ["error", 2]*/
                  
                  function a(x) {
                      if (true) {
                          return x;
                      } else if (false) {
                          return x+1;
                      } else {
                          return 4; // 3rd path
                      }
                  }

                  Examples of correct code for a maximum of 2:

                  /*eslint complexity: ["error", 2]*/
                  
                  function a(x) {
                      if (true) {
                          return x;
                      } else {
                          return 4;
                      }
                  }

                  Options

                  Optionally, you may specify a max object property:

                  "complexity": ["error", 2]

                  is equivalent to

                  "complexity": ["error", { "max": 2 }]

                  Deprecated: the object property maximum is deprecated. Please use the property max instead.

                  When Not To Use It

                  If you can't determine an appropriate complexity limit for your code, then it's best to disable this rule.

                  Further Reading

                  Related Rules

                  • [max-depth](max-depth.md)
                  • [max-len](max-len.md)
                  • [max-nested-callbacks](max-nested-callbacks.md)
                  • [max-params](max-params.md)
                  • [max-statements](max-statements.md) Source: http://eslint.org/docs/rules/

                  Function has a complexity of 7.
                  Open

                      AwsSignatureV4.prototype.canonicalQueryString = function () {
                  Severity: Minor
                  Found in evaporate.js by eslint

                  Limit Cyclomatic Complexity (complexity)

                  Cyclomatic complexity measures the number of linearly independent paths through a program's source code. This rule allows setting a cyclomatic complexity threshold.

                  function a(x) {
                      if (true) {
                          return x; // 1st path
                      } else if (false) {
                          return x+1; // 2nd path
                      } else {
                          return 4; // 3rd path
                      }
                  }

                  Rule Details

                  This rule is aimed at reducing code complexity by capping the amount of cyclomatic complexity allowed in a program. As such, it will warn when the cyclomatic complexity crosses the configured threshold (default is 20).

                  Examples of incorrect code for a maximum of 2:

                  /*eslint complexity: ["error", 2]*/
                  
                  function a(x) {
                      if (true) {
                          return x;
                      } else if (false) {
                          return x+1;
                      } else {
                          return 4; // 3rd path
                      }
                  }

                  Examples of correct code for a maximum of 2:

                  /*eslint complexity: ["error", 2]*/
                  
                  function a(x) {
                      if (true) {
                          return x;
                      } else {
                          return 4;
                      }
                  }

                  Options

                  Optionally, you may specify a max object property:

                  "complexity": ["error", 2]

                  is equivalent to

                  "complexity": ["error", { "max": 2 }]

                  Deprecated: the object property maximum is deprecated. Please use the property max instead.

                  When Not To Use It

                  If you can't determine an appropriate complexity limit for your code, then it's best to disable this rule.

                  Further Reading

                  Related Rules

                  • [max-depth](max-depth.md)
                  • [max-len](max-len.md)
                  • [max-nested-callbacks](max-nested-callbacks.md)
                  • [max-params](max-params.md)
                  • [max-statements](max-statements.md) Source: http://eslint.org/docs/rules/

                  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
                          Severity
                          Category
                          Status
                          Source
                          Language