YouTransfer/YouTransfer

View on GitHub

Showing 28 of 61 total issues

Function exports has a Cognitive Complexity of 74 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = (function() {

    var self = {};
    self.settings = require('./settings');
    self.log = require('./logger')('youtransfer');
Severity: Minor
Found in lib/youtransfer.js - About 1 day 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 exports has 257 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = (function() {

    var self = {};
    self.settings = require('./settings');
    self.log = require('./logger')('youtransfer');
Severity: Major
Found in lib/youtransfer.js - About 1 day to fix

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

    module.exports = function(req, res, next) {
    
        // Fixing missing parsed body object in Restify (for usage in Passport)
        req.body = req.params;
    
    
    Severity: Major
    Found in lib/middleware.js - About 4 hrs to fix

      Function Fileupload has 78 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function Fileupload(element) {
          var component = this;
          component.$element = $(element);
          component.$element.addClass(DROPZONE_CLASS);
      
      
      Severity: Major
      Found in src/js/components/fileupload/fileupload.js - About 3 hrs to fix

        Function exports has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

        module.exports = function(req, res, next) {
        
            // Fixing missing parsed body object in Restify (for usage in Passport)
            req.body = req.params;
        
        
        Severity: Minor
        Found in lib/middleware.js - About 2 hrs 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

        File youtransfer.js has 275 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        'use strict';
        
        // ------------------------------------------------------------------------------------------ Dependencies
        
        require('date-utils');
        Severity: Minor
        Found in lib/youtransfer.js - About 2 hrs to fix

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

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

            File routes.js has 260 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            'use strict';
            
            // ------------------------------------------------------------------------------------------ Dependencies
            
            require('date-utils');
            Severity: Minor
            Found in lib/routes.js - About 2 hrs to fix

              Function render has 46 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  res.render = function(name, context, callback) {
                      callback = callback || function() {};
                      res.setHeader('Server', 'youtransfer.io');
              
                      youtransfer.settings.get(function(err, settings) {
              Severity: Minor
              Found in lib/middleware.js - About 1 hr to fix

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

                    self.send = function(req, res, next) {
                        self.settings.get(function(err, settings) {
                            if(!err) {
                                var fields = _.clone(req.params);
                                fields.baseUrl = settings.general.baseUrl;
                Severity: Minor
                Found in lib/youtransfer.js - About 1 hr to fix

                  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

                          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

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