Showing 37 of 45 total issues
Function condMet
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
module.exports.prototype.condMet = function(cond, username, path, cb) {
this.getRevision(username, path, function(err, revision) {
var i, found;
if (err) {
cb(err);
- 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 requests.js
has 330 lines of code (exceeds 250 allowed). Consider refactoring. Open
var url = require('url'),
sha1 = require('sha1'),
async = require('async');
module.exports = function(pathPrefix, scopesInstance, mainInstance) {
Function getFolderDescription
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
module.exports.prototype.getFolderDescription = function(username, path, folderFormat, cb) {
this.getContent(username, path, function(err, content) {
var i, itemNames, revisions = {}, todo = 1, error, errorSent;
if (content) {
try {
- 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 doHead
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
module.exports.prototype.doHead = function(req, res, release, username, path, folderContentType) {
if (path.substr(-1) === '/') {
this.mainInstance.getRevision(username, path, function(err, revision) {
if (err) {
this.error(res, err, req.headers.origin);
- 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 handleRequest
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.prototype.handleRequest = function(req, res, folderFormat, folderContentType, folder404s) {
var urlObj = url.parse(req.url, true);
var path = urlObj.pathname.substring(this.pathPrefix.length);
var pos = path.indexOf('/');
var username = path.substring(0, pos);
File main.js
has 252 lines of code (exceeds 250 allowed). Consider refactoring. Open
var sha1 = require('sha1');
module.exports = function(dataStore) {
this.dataStore = dataStore;
};
Function getFolderDescription
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.prototype.getFolderDescription = function(username, path, folderFormat, cb) {
this.getContent(username, path, function(err, content) {
var i, itemNames, revisions = {}, todo = 1, error, errorSent;
if (content) {
try {
Function revisionsToMap
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.prototype.revisionsToMap = function(revisions, username, path, cb) {
var i, items = {}, todo = 1, error, errorSent;
function doneOne() {
if (error) {
if (!errorSent) {
Function setParents
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.prototype.setParents = function(username, pathParts, fileItself, revision, cb) {
if (pathParts.length <= 1) {
cb();
} else {
var thisPart = pathParts.pop();
Function getWebfingerLink
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.prototype.getWebfingerLink = function(protocol, host, port, userName, authUrl, webAuthoring) {
switch (this.specVersion) {
case 'draft-dejong-remotestorage-00':
return {
href: protocol + '://' + host + ':' + port + '/storage/' + userName,
Function doGet
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.prototype.doGet = function(req, res, release, username, path, folderFormat, folderContentType) {
if (path.substr(-1) === '/') {
this.mainInstance.getRevision(username, path, function(err, revision) {
if (err) {
this.error(res, err, req.headers.origin);
Function may
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.prototype.may = function(authorizationHeader, username, path, write, cb) {
var i, scopeParts, scopes, pathParts;
if (write && path.substr(-1) === '/') {
cb(null, false);
} else if (path[0] !== '/' || username.length === 0) {
Function doHead
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.prototype.doHead = function(req, res, release, username, path, folderContentType) {
if (path.substr(-1) === '/') {
this.mainInstance.getRevision(username, path, function(err, revision) {
if (err) {
this.error(res, err, req.headers.origin);
Function condMet
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.prototype.condMet = function(cond, username, path, cb) {
this.getRevision(username, path, function(err, revision) {
var i, found;
if (err) {
cb(err);
Function revisionsToMap
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
module.exports.prototype.revisionsToMap = function(revisions, username, path, cb) {
var i, items = {}, todo = 1, error, errorSent;
function doneOne() {
if (error) {
if (!errorSent) {
- 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 set
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
module.exports.prototype.set = function(username, path, dataBuf, contentType, revision, cb) {
this.dataStore.set(username, 'content:' + path, dataBuf, function(err1) {
if (err1) {
cb(err1);
return;
- 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 checkFound
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
module.exports.prototype.checkFound = function(req, res, username, path, folder404s, cb, release) {
Function doGet
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
module.exports.prototype.doGet = function(req, res, release, username, path, folderFormat, folderContentType) {
Function checkCondMet
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
module.exports.prototype.checkCondMet = function(req, res, username, path, statusCode, cb, release) {
Function writeHead
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
module.exports.prototype.writeHead = function(res, status, origin, revision, contentType, contentLength) {