Showing 459 of 552 total issues
Function exports
has a Cognitive Complexity of 82 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (Posts) {
Posts.getQueuedPosts = async (filter = {}, options = {}) => {
options = { metadata: true, ...options }; // defaults
let postData = _.cloneDeep(cache.get('post-queue'));
if (!postData) {
- 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 353 lines of code (exceeds 75 allowed). Consider refactoring. Open
module.exports = function (Posts) {
Posts.getQueuedPosts = async (filter = {}, options = {}) => {
options = { metadata: true, ...options }; // defaults
let postData = _.cloneDeep(cache.get('post-queue'));
if (!postData) {
Function exports
has 341 lines of code (exceeds 75 allowed). Consider refactoring. Open
module.exports = function (module) {
const helpers = require('./helpers');
module.setObject = async function (key, data) {
if (!key || !data) {
Function exports
has a Cognitive Complexity of 78 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (Groups) {
Groups.update = async function (groupName, values) {
const exists = await db.exists(`group:${groupName}`);
if (!exists) {
throw new Error('[[error:no-group]]');
- 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 334 lines of code (exceeds 75 allowed). Consider refactoring. Open
module.exports = function (Topics) {
Topics.getTotalUnread = async function (uid, filter) {
filter = filter || '';
const counts = await Topics.getUnreadTids({ cid: 0, uid: uid, count: true });
return counts && counts[filter];
Function exports
has a Cognitive Complexity of 74 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (module) {
const helpers = require('./helpers');
module.setObject = async function (key, data) {
if (!key || !data) {
- 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
File flags.js
has 871 lines of code (exceeds 500 allowed). Consider refactoring. Open
'use strict';
const _ = require('lodash');
const winston = require('winston');
const validator = require('validator');
Function exports
has a Cognitive Complexity of 72 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (Topics) {
Topics.getTotalUnread = async function (uid, filter) {
filter = filter || '';
const counts = await Topics.getUnreadTids({ cid: 0, uid: uid, count: true });
return counts && counts[filter];
- 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 72 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (Topics) {
const topicTools = {};
Topics.tools = topicTools;
topicTools.delete = async function (tid, uid) {
- 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 71 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (Categories) {
Categories.getCategoryTopics = async function (data) {
let results = await plugins.hooks.fire('filter:category.topics.prepare', data);
const tids = await Categories.getTopicIds(results);
let topicsData = await topics.getTopicsByTids(tids, data.uid);
- 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 308 lines of code (exceeds 75 allowed). Consider refactoring. Open
module.exports = function (utils, Benchpress, relative_path) {
Benchpress.setGlobal('true', true);
Benchpress.setGlobal('false', false);
const oneDayInMs = 24 * 60 * 60 * 1000;
Function exports
has a Cognitive Complexity of 69 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (Topics) {
Topics.getSortedTopics = async function (params) {
const data = {
nextStart: 0,
topicCount: 0,
- 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 69 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (module) {
const helpers = require('./helpers');
const cache = require('../cache').create('redis');
- 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 69 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (User) {
const fieldWhitelist = [
'uid', 'username', 'userslug', 'email', 'email:confirmed', 'joindate',
'lastonline', 'picture', 'icon:bgColor', 'fullname', 'location', 'birthday', 'website',
'aboutme', 'signature', 'uploadedpicture', 'profileviews', 'reputation',
- 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 email
has a Cognitive Complexity of 67 (exceeds 10 allowed). Consider refactoring. Open
Interstitials.email = async (data) => {
if (!data.userData) {
throw new Error('[[error:invalid-data]]');
}
if (!data.userData.updateEmail) {
- 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 285 lines of code (exceeds 75 allowed). Consider refactoring. Open
module.exports = function (module) {
const utils = require('../../utils');
const helpers = require('./helpers');
const dbHelpers = require('../helpers');
Function exports
has a Cognitive Complexity of 64 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (module) {
module.sortedSetIntersectCard = async function (keys) {
if (!Array.isArray(keys) || !keys.length) {
return 0;
}
- 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 280 lines of code (exceeds 75 allowed). Consider refactoring. Open
module.exports = function (User) {
const fieldWhitelist = [
'uid', 'username', 'userslug', 'email', 'email:confirmed', 'joindate',
'lastonline', 'picture', 'icon:bgColor', 'fullname', 'location', 'birthday', 'website',
'aboutme', 'signature', 'uploadedpicture', 'profileviews', 'reputation',
Function exports
has 279 lines of code (exceeds 75 allowed). Consider refactoring. Open
module.exports = function (User) {
User.updateProfile = async function (uid, data, extraFields) {
let fields = [
'username', 'email', 'fullname', 'website', 'location',
'groupTitle', 'birthday', 'signature', 'aboutme',
Function exports
has a Cognitive Complexity of 58 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (User) {
User.create = async function (data) {
data.username = data.username.trim();
data.userslug = slugify(data.username);
if (data.email !== undefined) {
- 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"