Showing 536 of 552 total issues
Function exports
has a Cognitive Complexity of 32 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (User) {
User.blocks = {
_cache: cacheCreate({
name: 'user:blocks',
max: 100,
- 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 147 lines of code (exceeds 75 allowed). Consider refactoring. Open
module.exports = function (Messaging) {
Messaging.newMessageCutoff = 1000 * 60 * 3;
Messaging.getMessagesFields = async (mids, fields) => {
if (!Array.isArray(mids) || !mids.length) {
Function exports
has 144 lines of code (exceeds 75 allowed). Consider refactoring. Open
module.exports = function (User) {
User.getInvites = async function (uid) {
const emails = await db.getSetMembers(`invitation:uid:${uid}`);
return emails.map(email => validator.escape(String(email)));
};
Function exports
has a Cognitive Complexity of 31 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (Topics) {
Topics.toggleFollow = async function (tid, uid) {
const exists = await Topics.exists(tid);
if (!exists) {
throw new Error('[[error:no-topic]]');
- 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 31 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (module) {
const helpers = require('../helpers');
const utils = require('../../../utils');
module.sortedSetAdd = async function (key, score, value) {
- 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 addPostHandlers
has 143 lines of code (exceeds 75 allowed). Consider refactoring. Open
function addPostHandlers(tid) {
const postContainer = components.get('topic');
handleSelectionTooltip();
Function exports
has 141 lines of code (exceeds 75 allowed). Consider refactoring. Open
module.exports = function (Topics) {
Topics.toggleFollow = async function (tid, uid) {
const exists = await Topics.exists(tid);
if (!exists) {
throw new Error('[[error:no-topic]]');
Function exports
has 141 lines of code (exceeds 75 allowed). Consider refactoring. Open
module.exports = function (Groups) {
Groups.getMembers = async function (groupName, start, stop) {
return await db.getSortedSetRevRange(`group:${groupName}:members`, start, stop);
};
Function exports
has 140 lines of code (exceeds 75 allowed). Consider refactoring. Open
module.exports = function (Plugins) {
async function registerPluginAssets(pluginData, fields) {
function add(dest, arr) {
dest.push(...(arr || []));
}
Function update
has a Cognitive Complexity of 30 (exceeds 10 allowed). Consider refactoring. Open
Flags.update = async function (flagId, uid, changeset) {
const current = await db.getObjectFields(`flag:${flagId}`, ['uid', 'state', 'assignee', 'type', 'targetId']);
if (!current.type) {
return;
}
- 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 30 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (Messaging) {
Messaging.setUserNotificationSetting = async (uid, roomId, value) => {
if (parseInt(value, 10) === -1) {
// go back to default
return await db.deleteObjectField(`chat:room:${roomId}:notification:settings`, 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 init
has 139 lines of code (exceeds 75 allowed). Consider refactoring. Open
ThreadTools.init = function (tid, topicContainer) {
renderMenu(topicContainer);
$('.topic-main-buttons [title]').tooltip({
container: '#content',
Function exports
has 139 lines of code (exceeds 75 allowed). Consider refactoring. Open
module.exports = function (Topics) {
Topics.getTeasers = async function (topics, options) {
if (!Array.isArray(topics) || !topics.length) {
return [];
}
Function exports
has 138 lines of code (exceeds 75 allowed). Consider refactoring. Open
module.exports = function (module) {
const helpers = require('./helpers');
module.flushdb = async function () {
await module.client.dropDatabase();
};
Function init
has 133 lines of code (exceeds 75 allowed). Consider refactoring. Open
Details.init = function () {
const detailsPage = components.get('groups/container');
groupName = ajaxify.data.group.name;
Function exports
has 132 lines of code (exceeds 75 allowed). Consider refactoring. Open
module.exports = function (Posts) {
const Diffs = {};
Posts.diffs = Diffs;
Diffs.exists = async function (pid) {
if (meta.config.enablePostHistory !== 1) {
Function processSortedSet
has a Cognitive Complexity of 28 (exceeds 10 allowed). Consider refactoring. Open
exports.processSortedSet = async function (setKey, process, options) {
options = options || {};
if (typeof process !== 'function') {
throw new Error('[[error:process-not-a-function]]');
- 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 28 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (Posts) {
Posts.delete = async function (pid, uid) {
return await deleteOrRestore('delete', pid, 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 28 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (Messaging) {
Messaging.newMessageCutoff = 1000 * 60 * 3;
Messaging.getMessagesFields = async (mids, fields) => {
if (!Array.isArray(mids) || !mids.length) {
- 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 handleScrollNav
has 131 lines of code (exceeds 75 allowed). Consider refactoring. Open
function handleScrollNav() {
if (!thumbs.length) {
return;
}