Showing 726 of 2,177 total issues
Function list
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
function list(options) {
var defer = q.defer();
var query = {};
if (options.type) {
- 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 canReply
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
module.exports.canReply = function(message, user, callback) {
if (!message || !user) {
return callback(new Error('Message and user are required'));
}
- 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
Avoid too many return
statements within this function. Open
Open
return json['gd:email'][0].$.address.replace('mailto:', '');
Avoid too many return
statements within this function. Open
Open
return json['gContact:nickname'][0];
Avoid too many return
statements within this function. Open
Open
return res.status(400).json({
error: {
code: 400,
message: 'Bad Request',
details: 'openpaas:source is required for subscription'
Avoid too many return
statements within this function. Open
Open
return json['gd:phoneNumber'][0].$.uri.replace('tel:', '');
Avoid too many return
statements within this function. Open
Open
return contact.nickname;
Avoid too many return
statements within this function. Open
Open
return getFormattedAddress(contact.addresses[0]);
Avoid too many return
statements within this function. Open
Open
return contact.urls[0].value;
Avoid too many return
statements within this function. Open
Open
return contact.tags[0].text;
Avoid too many return
statements within this function. Open
Open
return contact.notes;
Avoid too many return
statements within this function. Open
Open
return contact.orgRole;
Avoid too many return
statements within this function. Open
Open
return esnDatetimeService.formatMediumDate(contact.birthday);
Avoid too many return
statements within this function. Open
Open
return email;
Avoid too many return
statements within this function. Open
Open
return tel;
Avoid too many return
statements within this function. Open
Open
return social;
Avoid too many return
statements within this function. Open
Open
return getGeneratedAvatar(req, res);
Avoid too many return
statements within this function. Open
Open
return composableMW([
requiresCollaborationMember,
targetUserCanBeRemoved
])(req, res, next);
Avoid too many return
statements within this function. Open
Open
return res.status(400).json({ error: { code: 400, message: 'Bad request', details: 'Unknown objectType parameter'}});
Avoid too many return
statements within this function. Open
Open
return targetUserCanBeRemoved(req, res, next);