YouTransfer/YouTransfer

View on GitHub

Showing 61 of 61 total issues

Function download has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

LocalFileStorage.prototype.download = function(token, res, next) {
    try {
        var self = this;
        var basedir = this.localstoragepath;
        if(token) {
Severity: Minor
Found in lib/localstorage.js - About 1 hr to fix

    Function register has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    Errors.prototype.register = function(error, code) {
        var self = this;
    
        if(_.isArray(error)) {
            _.each(Object.keys(error), function(key) {
    Severity: Minor
    Found in lib/errors.js - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function archive has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    S3Storage.prototype.archive = function(token, res, next) {
        try {
            if(token) {
                var s3obj = this.s3obj;
                s3obj.getObject({
    Severity: Minor
    Found in lib/s3storage.js - About 1 hr to fix

      Function get has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              get: function(next) {
                  self.settings.get(function(err, settings) {
                      var transporter = nodemailer.createTransport();
                      if(settings.email.transporter === 'smtp') {
                          if(smtpWellkown(settings.email.service)) {
      Severity: Minor
      Found in lib/youtransfer.js - About 1 hr to fix

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

        LocalFileStorage.prototype.purge = function(next) {
            var basedir = this.localstoragepath;
            fs.readdir(basedir, function(err, files) {
        
                var filesToDelete = [];
        Severity: Minor
        Found in lib/localstorage.js - About 1 hr to fix

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

          $(document).on('xhr.loaded', function(event, element, target) {
              $(target).find(COMPONENT_SELECTOR).each(function(index, item) {
                  return new Anchor(item);
              });
          });
          Severity: Major
          Found in src/js/components/anchor/anchor.js and 4 other locations - About 1 hr to fix
          src/js/components/fileupload/fileupload.js on lines 134..138
          src/js/components/form/form.js on lines 41..45
          src/js/components/select-section/select-section.js on lines 42..46
          src/js/components/tabs/tabs.js on lines 41..45

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

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

          $(document).on('xhr.loaded', function(event, element, target) {
              $(target).find(COMPONENT_SELECTOR).each(function(index, item) {
                  return new Form(item);
              });
          });
          Severity: Major
          Found in src/js/components/form/form.js and 4 other locations - About 1 hr to fix
          src/js/components/anchor/anchor.js on lines 49..53
          src/js/components/fileupload/fileupload.js on lines 134..138
          src/js/components/select-section/select-section.js on lines 42..46
          src/js/components/tabs/tabs.js on lines 41..45

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

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

          $(document).on('xhr.loaded', function(event, element, target) {
              $(target).find(COMPONENT_SELECTOR).each(function(index, item) {
                  return new Fileupload(item);
              });
          });
          Severity: Major
          Found in src/js/components/fileupload/fileupload.js and 4 other locations - About 1 hr to fix
          src/js/components/anchor/anchor.js on lines 49..53
          src/js/components/form/form.js on lines 41..45
          src/js/components/select-section/select-section.js on lines 42..46
          src/js/components/tabs/tabs.js on lines 41..45

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

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

          $(document).on('xhr.loaded', function(event, element, target) {
              $(target).find(COMPONENT_SELECTOR).each(function(index, item) {
                  return new SelectSection(item);
              });
          });
          Severity: Major
          Found in src/js/components/select-section/select-section.js and 4 other locations - About 1 hr to fix
          src/js/components/anchor/anchor.js on lines 49..53
          src/js/components/fileupload/fileupload.js on lines 134..138
          src/js/components/form/form.js on lines 41..45
          src/js/components/tabs/tabs.js on lines 41..45

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

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

          $(document).on('xhr.loaded', function(event, element, target) {
              $(target).find(COMPONENT_SELECTOR).each(function(index, item) {
                  return new Tabs(item);
              });
          });
          Severity: Major
          Found in src/js/components/tabs/tabs.js and 4 other locations - About 1 hr to fix
          src/js/components/anchor/anchor.js on lines 49..53
          src/js/components/fileupload/fileupload.js on lines 134..138
          src/js/components/form/form.js on lines 41..45
          src/js/components/select-section/select-section.js on lines 42..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 63.

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

          S3Storage.prototype.purge = function(next) {
              try {
                  var s3obj = this.s3obj;
                  var filesToDelete = [];
                  s3obj.listObjects(function(err, data) {
          Severity: Minor
          Found in lib/s3storage.js - About 1 hr to fix

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

            Router.prototype.upload = function() {
                return function(req, res, next) {
            
                    req.errors.register(new Error('An error occurred while uploading your file(s).'));
                    var payload = req.files.payload || req.files['dz-payload'];
            Severity: Minor
            Found in lib/routes.js - About 1 hr to fix

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

              Router.prototype.download = function() {
                  return function(req, res, next) {
              
                      req.errors.register([
                          {
              Severity: Minor
              Found in lib/routes.js - About 1 hr to fix

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

                S3Storage.prototype.download = function(token, res, next) {
                    try {
                        if(token) {
                            var s3obj = this.s3obj;
                            s3obj.getObject({
                Severity: Minor
                Found in lib/s3storage.js - About 1 hr to fix

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

                      beforeEach(function() {
                          $('body').empty();
                          sandbox = sinon.sandbox.create();
                          $(document).off('xhr.loaded.tabs');
                      });
                  Severity: Major
                  Found in src/js/components/tabs/tabs.test.js and 1 other location - About 1 hr to fix
                  src/js/components/form/form.test.js on lines 17..21

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

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

                  Errors.prototype.register = function(error, code) {
                      var self = this;
                  
                      if(_.isArray(error)) {
                          _.each(Object.keys(error), function(key) {
                  Severity: Minor
                  Found in lib/errors.js - About 1 hr to fix

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

                                if(req.errors.exist()) {
                                    context.errors = context.errors || [];
                                    context.errors = _.merge(context.errors, req.errors.get());
                                }
                    Severity: Major
                    Found in lib/middleware.js and 1 other location - About 1 hr to fix
                    lib/middleware.js on lines 81..84

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

                    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

                                if(req.errors.exist()) {
                                    context.errors = context.errors || [];
                                    context.errors = _.merge(context.errors, req.errors.get());
                                }
                    Severity: Major
                    Found in lib/middleware.js and 1 other location - About 1 hr to fix
                    lib/middleware.js on lines 51..54

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

                    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

                        beforeEach(function() {
                            $('body').empty();
                            sandbox = sinon.sandbox.create();
                            $(document).off('component.form.success');
                        });
                    Severity: Major
                    Found in src/js/components/form/form.test.js and 1 other location - About 1 hr to fix
                    src/js/components/tabs/tabs.test.js on lines 17..21

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

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

                        self.initialize = function() {
                            self.settings.get(function(err, settings) {
                                if(!err) {
                                    if(settings.general.schedulerEnabled) {
                                        self.log.info('Scheduled cleanup of expired files');
                    Severity: Minor
                    Found in lib/youtransfer.js - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language