Showing 101 of 230 total issues
Function search
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
UserSchema.statics.search = function(queryTerms, searchTerms, limit, offset, sortArr) {
Function search
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
CacheEntrySchema.statics.search = function(queryTerms, searchTerms, limit, offset, sortArr) {
Function search
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
TeamSchema.statics.search = function(queryTerms, searchTerms, limit, offset, sortArr) {
Function search
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
TagSchema.statics.search = function(queryTerms, searchTerms, limit, offset, sortArr) {
Function addMemberToTeam
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function addMemberToTeam(user, team, role, requester, headers) {
Function updateMemberRole
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function updateMemberRole(user, team, role, requester, headers) {
Function search
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
AuditSchema.statics.search = function(queryTerms, searchTerms, limit, offset, sortArr) {
Function search
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
UserAgreementSchema.statics.search = function(queryTerms, searchTerms, limit, offset, sortArr) {
Function initDerivedConfig
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
let initDerivedConfig = (config) => {
if (config.app && config.app.url && config.app.url.protocol && config.app.url.host) {
config.app.baseUrlWithoutPort = `${config.app.url.protocol}://${config.app.url.host}`;
if (config.app.url.port) {
- 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 checkAccess
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected checkAccess(url: string, route: ActivatedRouteSnapshot): boolean {
let requiresAuthentication: boolean = true; // default this to true unless told otherwise...
// Only set it to false if it is explicitly set
if (null != route.data && (route.data as any).requiresAuthentication === false) {
- 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 requiresAny
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
module.exports.requiresAny = (requirements) => {
return (req) => {
// Apply the requirements
let error;
- 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 checkExternalRoles
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
module.exports.checkExternalRoles = function(user, configAuth) {
// If there are required roles, check for them
if (null != configAuth && _.isArray(configAuth.requiredRoles) && configAuth.requiredRoles.length > 0) {
// Get the user roles
var userRoles = (null != user && _.isArray(user.externalRoles)) ? user.externalRoles : [];
- 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
return Date.parse(date);
Avoid too many return
statements within this function. Open
return null;
Function search
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
exports.search = function(req, res) {
let search = req.body.s || null;
let query = req.body.q || {};
query = util.toMongoose(query);
- 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 validatePassword
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public validatePassword(p1: string, p2: string): any {
p1 = (_.isString(p1) && p1.trim().length > 0) ? p1 : undefined;
p2 = (_.isString(p2) && p2.trim().length > 0) ? p2 : undefined;
if (p1 !== p2) {
- 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 ignorePayload
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
KafkaSocket.prototype.ignorePayload = function(rawMessage, json, consumer) {
// Ignore any payloads that are too old.
if (null != ignoreOlderThan) {
var now = Date.now();
var messageTime = this.getMessageTime(json);
- 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 containsQuery
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
module.exports.containsQuery = function(schema, query, fields, search, limit, offset, sortArr, runCount) {
// Initialize find to null
var find = generateFind(query);
var projection = {};
var options = {};
- 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 requiresRole
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
module.exports.requiresRole = function(role) {
return function(req) {
// Verify that the user and tag are on the request
let user = req.user.toObject();
- 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 getConsumer
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
KafkaConsumer.prototype.getConsumer = function() {
let self = this;
// Initialize the deferred promise, if we don't already have one.
self.deferred = self.deferred || q.defer();
- 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"