Showing 726 of 2,177 total issues
Function exports
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function(dependencies, lib) {
function getImporter(req, res, next) {
var type = req.params.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 get
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function get(req, res) {
var activity_stream = req.activity_stream;
if (!activity_stream) {
return res.status(400).json({error: {code: 400, message: 'Bad Request', details: 'Activity Stream is missing'}});
- 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 start
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function start(port, options, callback) {
if (arguments.length === 0) {
logger.error('Websocket server start method should have at least 1 argument');
process.exit(1);
}
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function(application) {
if (mongo.isConnected()) {
onMongoConnected();
}
topic.subscribe(onMongoConnected);
- 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 aggregate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function aggregate(sources, limit) {
const destinations = [];
let numberOfItemsToCollect = limit;
for (let round = 0; numberOfItemsToCollect > 0; round++) {
- 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 store
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
module.exports.store = function(id, contentType, metadata, stream, options, callback) {
var mongoId = getMongoID(id);
if (!mongoId) {
return callback(new Error('ID is mandatory'));
- 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 getTimelineEntries
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function getTimelineEntries(options = {}, callback) {
const getQuery = () => {
const findOptions = {};
if (options.verb) {
- 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 runGrunt
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
GruntfileUtils.prototype.runGrunt = function runGrunt() {
var grunt = this.grunt;
var args = this.args;
function _process(res) {
Function addressbookHome
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
ContactAPIClient.addressbookHome = function(bookId) {
return {
addressbook: function(bookName) {
return {
Function UserDisplayShell
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
var UserDisplayShell = function(shell) {
var self = this;
if (shell) {
this.shell = shell;
Function checkArrAddressMatching
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function checkArrAddressMatching(array, query, iconClass) {
function getMinOfArray(numArray) {
return Math.min.apply(null, numArray);
}
if (typeof array === 'undefined') {
Function _injectOwnerToSubscription
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function _injectOwnerToSubscription(addressbooks) {
var userIds = [];
addressbooks.forEach(function(addressbook) {
if (addressbook.isSubscription && !addressbook.group) {
Function fromCardSearchResponse
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.fromCardSearchResponse = function(response) {
var self = this;
if (response && response.data && response.data._embedded &&
response.data._embedded['dav:item'] && response.data._embedded['dav:item'].length) {
Function addressbookHome
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
ContactAPIClient.addressbookHome = function(bookId) {
return {
addressbook: function(bookName) {
return {
Function displayMessage
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function displayMessage(message, type, delay) {
if (!message) {
return;
}
Function validateWriteBody
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function validateWriteBody(req, res, next) {
const config = req.body;
validator
.validate('core', 'themes', config)
Function get
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function get(req, res) {
if (!req.query.objectType) {
if (!req.query.email || typeof req.query.email !== 'string' || req.query.email.length === 0) {
return res.status(400).json({ error: { code: 400, message: 'Bad request', details: 'When no objectType is provided, email is mandatory and must be a non-empty string'}});
}
Function requirePlatformAdminOrDomainAdmin
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function requirePlatformAdminOrDomainAdmin(req, res, next) {
const user = req.user;
const domain = req.domain;
platformAdminModule.isPlatformAdmin(user.id).then(isPlatformAdmin => {
Function importContacts
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function importContacts(type, account) {
var importer = ContactImportRegistry.get(type);
if (!importer) {
$log.error('Can not find importer ' + type);
Function loadDomainByHostname
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function loadDomainByHostname(req, res, next) {
const hostname = req.hostname;
coreDomain.getByHostname(hostname)
.then(domain => {