Showing 101 of 230 total issues
Function initialize
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public initialize() {
this.messageService.initialize();
this.authentication.initializing$
.subscribe(() => {
Function searchTest
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.searchTest = function(req, res) {
let query = req.body.q || {};
let search = req.body.s;
if (search) {
Function filterResourcesByAccess
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function filterResourcesByAccess(ids, user) {
if (!_.isArray(ids)) {
return q([]);
}
else {
Function updateRole
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
updateRole(member: TeamMember, role: string) {
// No update required
if (member.role === role) {
return;
}
Function exports
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function(columns) {
// Create a stream to turn Mongo records into CSV rows
var stream = through2.obj(function (chunk, enc, callback) {
var row = [];
Function handleErrorResponse
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected handleErrorResponse(err: any, _caught: Observable<any>): Observable<any> {
let errData = _.isString(err._body) ? JSON.parse(err._body) : err._body;
switch (err.status) {
case 401:
Function searchEuas
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports.searchEuas = (req, res) => {
// Handle the query/search/page
let query = req.body.q;
let search = req.body.s;
Function pagingQuery
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function pagingQuery(schema, find, projection, options, sort, limit, offset, runCount) {
// Build the query
var baseQuery = schema.find(find);
var findQuery = schema.find(find, projection, options).sort(sort).skip(offset).limit(limit).maxscan(config.maxScan);
Function getTimeFilterQueryObject
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
private getTimeFilterQueryObject(): any {
let timeQuery: any = null;
if (this.dateRangeFilter.selected === 'choose') {
if (null != this.queryStartDate) {
- 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 searchUsers
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function searchUsers(req, res, copyUserFn) {
// Handle the query/search/page
let query = req.body.q;
let search = req.body.s;
Function matchEntries
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.matchEntries = function(req, res) {
// Handle the query/search/page
var query = req.body.q;
var search = req.body.s;
Function matchUsers
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.matchUsers = (req, res) => {
// Handle the query/search/page
let query = req.body.q;
let search = req.body.s;
Function initialize
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public initialize() {
// Subscribe to state changes
this.notificationStateService.notificationsCleared$
.subscribe((clear) => {
Function searchEntries
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports.searchEntries = function(req, res) {
// Handle the query/search/page
var query = req.body.q;
var search = req.body.s;
Function search
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.search = function(req, res) {
// Handle the query/search/page
let query = req.body.q;
let search = req.body.s;
Function ngOnInit
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
ngOnInit() {
this.dateRangeOptions = [
{ value: -1, display: 'Last 24 Hours' },
{ value: -3, display: 'Last 3 Days' },
{ value: -7, display: 'Last 7 Days' },
Function sendMail
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const sendMail = (mailOptions) => {
return new Promise((resolve, reject) => {
const postData = JSON.stringify(transformMailOptions(mailOptions));
const options = generateOptions();
Function search
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.search = function(req, res) {
let search = req.body.s || null;
let query = req.body.q || {};
query = util.toMongoose(query);
Function ngOnInit
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
ngOnInit() {
this.alertService.clearAllAlerts();
this.user = this.authService.getCurrentUser();
Function adminGetFeedbackCSV
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.adminGetFeedbackCSV = function(req, res) {
let exportFileName;
const exportId = req.params.exportId;
const dateCallback = (value) => (value) ? new Date(value).toISOString(): '';