YouTransfer/YouTransfer

View on GitHub

Showing 28 of 61 total issues

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

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

        self.upload = function(file, bundle, next) {
            self.settings.get(function(err, settings) {
                var basedir = settings.storage.localstoragepath;
                var retention = {};
                retention[settings.storage.retentionUnit] = parseInt(settings.storage.retention);
    Severity: Minor
    Found in lib/youtransfer.js - About 1 hr to fix

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

      Router.prototype.settingsGetTemplateByName = function() {
          return function(req, res, next) {
      
              req.errors.register([
                  new Error('An error occurred while trying to retrieve the template'),
      Severity: Minor
      Found in lib/routes.js - About 1 hr to fix

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

        module.exports = (function() {
        
            var self = require('passport');
        
            // Serialization
        Severity: Minor
        Found in lib/passport.js - About 1 hr to fix

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

          Settings.prototype.get = function(next) {
              var self = this;
          
              self.cache.get('settings', function(err, cached) {
                  if(_.isUndefined(cached)) {
          Severity: Minor
          Found in lib/settings.js - About 1 hr to fix

            Avoid deeply nested control flow statements.
            Open

                                                    if(settings.email.sendCopy) {
                                                        email.cc = settings.email.sender;
                                                    }
            Severity: Major
            Found in lib/youtransfer.js - About 45 mins to fix

              Function upload has a Cognitive Complexity of 7 (exceeds 5 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 35 mins 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 download has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              Router.prototype.download = function() {
                  return function(req, res, next) {
              
                      req.errors.register([
                          {
              Severity: Minor
              Found in lib/routes.js - About 35 mins 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

              Severity
              Category
              Status
              Source
              Language