Showing 101 of 230 total issues
Function getQuery
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private getQuery(): any {
let query: any;
let elements: any[] = [];
if (this.filters.bypassAC) {
Function audit
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports.audit = function(message, eventType, eventAction, eventActor, eventObject, eventMetadata) {
let Audit = dbs.admin.model('Audit');
let utilService = deps.utilService;
// Extract additional metadata to audit
Function signupEmail
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports.signupEmail = function(user, req) {
let defer = q.defer();
req.app.render('../../admin/templates/user-signup-alert-email', {
name: user.name,
Function exports
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function(app, db) {
// Create a new HTTP server
logger.info('Creating HTTP Server');
var server = http.createServer(app);
Function searchTeamMembers
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function searchTeamMembers(search, query, queryParams, team) {
let page = util.getPage(queryParams);
let limit = util.getLimit(queryParams);
let offset = page * limit;
Function verify
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports.verify = function(role) {
return function(req, res, next) {
// Grab the Authentication header
var authentication = req.headers.authentication;
Function getValidationErrors
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
function getValidationErrors(err) {
var errors = [];
if(null != err.errors) {
for (var field in err.errors) {
- 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 verify
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
module.exports.verify = function(role) {
return function(req, res, next) {
// Grab the Authentication header
var authentication = req.headers.authentication;
- 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 kafkaPayloadHandler
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
KafkaSocket.prototype.kafkaPayloadHandler = function(consumer, message) {
// Gracefully handle empty messages by ignoring and logging
if (null == message) {
logger.warn('%s: Ignoring empty message %s', this.name, message);
return;
Function getGlobbedPaths
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
let getGlobbedPaths = (globPatterns, excludes) => {
// URL paths regex
let urlRegex = new RegExp('^(?:[a-z]+:)?//', 'i');
// The output array
Function adminUpdateUser
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.adminUpdateUser = (req, res) => {
// The persistence user
let user = req.userParam;
Function get
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports.get = function (id) {
var defer = q.defer();
if(null == id) {
return q.reject('id cannot be null or undefined');
Function ngOnInit
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
ngOnInit() {
this.tag = new Tag();
this.route.params.subscribe((params: Params) => {
this.mode = params[`mode`];
Function socketPayloadHandler
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
EventSocket.prototype.socketPayloadHandler = function(eventName, message) {
// Gracefully handle empty messages by ignoring and logging
if (null == message) {
logger.warn('%s: Ignoring empty message %s', this.name, message);
return;
Function exports
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function(delay) {
delay = delay || 10;
// Store all the active timeouts
var timeouts = [];
Function initMiddleware
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function initMiddleware(app) {
// Showing stack errors
app.set('showStackError', true);
// Should be placed before express.static
Function getErrorMessage
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports.getErrorMessage = function(err) {
var message = '';
if (null == err || typeof err === 'string') {
message = err;
Function checkAdminAccess
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected checkAdminAccess(url: string, route: ActivatedRouteSnapshot): boolean {
if (!this.userStateService.user.isAdmin()) {
// -----------------------------------------------------------
// Check the role requirements for the route
// -----------------------------------------------------------
Function containsQuery
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
module.exports.containsQuery = function(schema, query, fields, search, limit, offset, sortArr, runCount) {
Function pagingQuery
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function pagingQuery(schema, find, projection, options, sort, limit, offset, runCount) {