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');
- Read upRead up
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');
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;
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);
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;
- Read upRead up
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');
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) {
File routes.js
has 260 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict';
// ------------------------------------------------------------------------------------------ Dependencies
require('date-utils');
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) {
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;
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) {
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) {
- Read upRead up
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({
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)) {
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 = [];
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) {
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'];
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([
{
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({
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) {