Showing 10 of 20 total issues
Function boxInList
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
function boxInList(searchedBoxPath, boxes) {
logger.debug('Test if ' + searchedBoxPath + ' is in ' + boxes);
for (var boxName in boxes) {
if (boxes.hasOwnProperty(boxName)) {
let box = boxes[boxName];
- 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 getMessages
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getMessages(imapConnection, boxName, ids, seqs, options, callback) {
logger.info('Getting messages by seqs#' + seqs + ' or ids#' + ids + ' in box#' + boxName + ' with options ' + JSON.stringify(options));
if (ids && seqs || (!ids && !seqs)) {
callback(new Error('Either ids or seqs must be defined'), null);
return;
Function findBoxBySpecialAttribute
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
function findBoxBySpecialAttribute(boxes, attribute, path) {
let matchingBoxes = [];
for (let boxName in boxes) {
if (boxes.hasOwnProperty(boxName)) {
let box = boxes[boxName];
- 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 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (opts) {
return function *(next) {
// request
var start = new Date;
logger.debug(' \x1B[90m<-- \x1B[;1m%s\x1B[0;90m %s\x1B[0m', this.method, this.url);
Function createConnection
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createConnection(username, password) {
logger.debug('Create connection structure for user#' + username);
connections[username] = {
"connection" : createImapConnection(username, password),
"callbacks" : [],
Function log
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function log(ctx, start, len, err, event) {
// get the status code of the response
var status = err
? (err.status || 500)
: (ctx.status || 404);
- 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 a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function (opts) {
return function *(next) {
// request
var start = new Date;
logger.debug(' \x1B[90m<-- \x1B[;1m%s\x1B[0;90m %s\x1B[0m', this.method, this.url);
- 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 getMessages
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function getMessages(imapConnection, boxName, ids, seqs, options, callback) {
Avoid deeply nested control flow statements. Open
if (boxInList(newSearchedBoxPath, box.children)) {
return true;
}
Function log
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function log(ctx, start, len, err, event) {