Showing 443 of 552 total issues
File chats.js
has 723 lines of code (exceeds 500 allowed). Consider refactoring. Open
'use strict';
define('forum/chats', [
'components',
Function exports
has 230 lines of code (exceeds 75 allowed). Consider refactoring. Open
module.exports = function (module) {
const helpers = require('./helpers');
module.flushdb = async function () {
await module.pool.query(`DROP SCHEMA "public" CASCADE`);
Function exports
has 222 lines of code (exceeds 75 allowed). Consider refactoring. Open
module.exports = function (middleware) {
async function authenticate(req, res) {
async function finishLogin(req, user) {
const loginAsync = util.promisify(req.login).bind(req);
await loginAsync(user, { keepSessionInfo: true });
Function init
has 219 lines of code (exceeds 75 allowed). Consider refactoring. Open
Plugins.init = function () {
const pluginsList = $('.plugins');
const numPlugins = pluginsList[0].querySelectorAll('li').length;
let pluginID;
Function exports
has a Cognitive Complexity of 48 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (Categories) {
Categories.create = async function (data) {
const parentCid = data.parentCid ? data.parentCid : 0;
const [cid, firstChild] = await Promise.all([
db.incrObjectField('global', 'nextCid'),
- 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 212 lines of code (exceeds 75 allowed). Consider refactoring. Open
module.exports = function (Categories) {
Categories.create = async function (data) {
const parentCid = data.parentCid ? data.parentCid : 0;
const [cid, firstChild] = await Promise.all([
db.incrObjectField('global', 'nextCid'),
Function exports
has 207 lines of code (exceeds 75 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);
Function init
has 199 lines of code (exceeds 75 allowed). Consider refactoring. Open
Category.init = function () {
const categorySettings = $('#category-settings');
const previewEl = $('[component="category/preview"]');
categorySettings.find('select').each(function () {
const $this = $(this);
Function exports
has a Cognitive Complexity of 44 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (middleware) {
middleware.addHeaders = helpers.try((req, res, next) => {
const headers = {
'X-Powered-By': encodeURI(meta.config['powered-by'] || 'NodeBB'),
'Access-Control-Allow-Methods': encodeURI(meta.config['access-control-allow-methods'] || ''),
- 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 197 lines of code (exceeds 75 allowed). Consider refactoring. Open
module.exports = function (module) {
const helpers = require('./helpers');
const cache = require('../cache').create('redis');
Function exports
has a Cognitive Complexity of 43 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (Groups) {
Groups.create = async function (data) {
const isSystem = isSystemGroup(data);
const timestamp = data.timestamp || Date.now();
let disableJoinRequests = parseInt(data.disableJoinRequests, 10) === 1 ? 1 : 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 43 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (Topics) {
Topics.createTopicFromPosts = async function (uid, title, pids, fromTid, cid) {
if (title) {
title = title.trim();
}
- 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 43 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (Posts) {
pubsub.on('post:edit', (pid) => {
require('./cache').del(pid);
});
- 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 42 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (Plugins) {
if (nconf.get('isPrimary')) {
pubsub.on('plugins:toggleInstall', (data) => {
if (data.hostname !== os.hostname()) {
toggleInstall(data.id, data.version);
- 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 42 (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 exports
has 189 lines of code (exceeds 75 allowed). Consider refactoring. Open
module.exports = function (module) {
module.sortedSetIntersectCard = async function (keys) {
if (!Array.isArray(keys) || !keys.length) {
return 0;
}
Function exports
has 188 lines of code (exceeds 75 allowed). Consider refactoring. Open
module.exports = function (User) {
const deletesInProgress = {};
User.delete = async (callerUid, uid) => {
await User.deleteContent(callerUid, uid);
Function exports
has a Cognitive Complexity of 41 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (Topics) {
Topics.getTeasers = async function (topics, options) {
if (!Array.isArray(topics) || !topics.length) {
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
File navigator.js
has 642 lines of code (exceeds 500 allowed). Consider refactoring. Open
'use strict';
define('navigator', [
'forum/pagination', 'components', 'hooks', 'alerts', 'translator', 'storage',
], function (pagination, components, hooks, alerts, translator, storage) {
Function exports
has 185 lines of code (exceeds 75 allowed). Consider refactoring. Open
module.exports = function (module) {
const helpers = require('./helpers');
module.listPrepend = async function (key, value) {
if (!key) {