Showing 444 of 553 total issues
Function checkPrivileges
has a Cognitive Complexity of 19 (exceeds 10 allowed). Consider refactoring. Open
middleware.checkPrivileges = helpers.try(async (req, res, next) => {
// Kick out guests, obviously
if (req.uid <= 0) {
return controllers.helpers.notAllowed(req, res);
}
- 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 registerComplete
has a Cognitive Complexity of 19 (exceeds 10 allowed). Consider refactoring. Open
authenticationController.registerComplete = async function (req, res) {
try {
// For the interstitials that respond, execute the callback with the form body
const data = await user.interstitials.get(req, req.session.registration);
const callbacks = data.interstitials.reduce((memo, cur) => {
- 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 19 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (module) {
const helpers = require('../helpers');
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 a Cognitive Complexity of 19 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (Posts) {
Posts.create = async function (data) {
// This is an internal method, consider using Topics.reply instead
const { uid } = data;
const { tid } = 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
Function exports
has a Cognitive Complexity of 19 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (opts) {
const TTLCache = require('@isaacs/ttlcache');
const pubsub = require('../pubsub');
const ttlCache = new TTLCache(opts);
- 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 createAdmin
has a Cognitive Complexity of 19 (exceeds 10 allowed). Consider refactoring. Open
async function createAdmin() {
const User = require('./user');
const Groups = require('./groups');
let password;
- 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 19 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (opts) {
const { LRUCache } = require('lru-cache');
const pubsub = require('../pubsub');
// lru-cache@7 deprecations
- 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 loadClientHeaderFooterData
has 92 lines of code (exceeds 75 allowed). Consider refactoring. Open
async function loadClientHeaderFooterData(req, res, options) {
const registrationType = meta.config.registrationType || 'normal';
res.locals.config = res.locals.config || {};
const templateValues = {
title: meta.config.title || '',
Function exports
has 92 lines of code (exceeds 75 allowed). Consider refactoring. Open
module.exports = function (Groups) {
Groups.leave = async function (groupNames, uid) {
if (Array.isArray(groupNames) && !groupNames.length) {
return;
}
Function loadRoom
has 92 lines of code (exceeds 75 allowed). Consider refactoring. Open
Messaging.loadRoom = async (uid, data) => {
const { roomId } = data;
const [room, inRoom, canChat, isAdmin, isGlobalMod] = await Promise.all([
Messaging.getRoomData(roomId),
Messaging.isUserInRoom(uid, roomId),
Function init
has 91 lines of code (exceeds 75 allowed). Consider refactoring. Open
categorySearch.init = function (el, options) {
let categoriesList = null;
options = options || {};
options.privilege = options.privilege || 'topics:read';
options.states = options.states || ['watching', 'tracking', 'notwatching', 'ignoring'];
Function exports
has 91 lines of code (exceeds 75 allowed). Consider refactoring. Open
module.exports = function (Groups) {
Groups.getPending = async function (groupName) {
return await Groups.getUsersFromSet(`group:${groupName}:pending`, ['username', 'userslug', 'picture']);
};
Function onMessage
has a Cognitive Complexity of 18 (exceeds 10 allowed). Consider refactoring. Open
async function onMessage(socket, payload) {
const { event, params, callback } = payload;
try {
if (!event) {
return winston.warn('[socket.io] Empty method name');
- 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 set
has a Cognitive Complexity of 18 (exceeds 10 allowed). Consider refactoring. Open
Themes.set = async (data) => {
switch (data.type) {
case 'local': {
const current = await Meta.configs.get('theme:id');
const score = await db.sortedSetScore('plugins:active', current);
- 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 modifyGroup
has a Cognitive Complexity of 18 (exceeds 10 allowed). Consider refactoring. Open
function modifyGroup(group, fields) {
if (group) {
db.parseIntFields(group, intFields, fields);
escapeGroupData(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 a Cognitive Complexity of 18 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (Groups) {
Groups.search = async function (query, options) {
if (!query) {
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 formatApiResponse
has a Cognitive Complexity of 18 (exceeds 10 allowed). Consider refactoring. Open
helpers.formatApiResponse = async (statusCode, res, payload) => {
if (res.req.method === 'HEAD') {
return res.sendStatus(statusCode);
}
- 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 method
has a Cognitive Complexity of 18 (exceeds 10 allowed). Consider refactoring. Open
method: function (callback) {
db.getSortedSetRange('categories:cid', 0, -1, (err, cids) => {
if (err) {
return callback(err);
}
- 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 18 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (User) {
User.startJobs = function () {
winston.verbose('[user/jobs] (Re-)starting jobs...');
let { digestHour } = meta.config;
- 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 89 lines of code (exceeds 75 allowed). Consider refactoring. Open
Groups.init = function () {
const groupIcon = $('#group-icon');
const changeGroupUserTitle = $('#change-group-user-title');
const changeGroupLabelColor = $('#change-group-label-color');
const changeGroupTextColor = $('#change-group-text-color');