Showing 441 of 550 total issues
Function exports
has a Cognitive Complexity of 40 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (Groups) {
Groups.getMembers = async function (groupName, start, stop) {
return await db.getSortedSetRevRange(`group:${groupName}:members`, start, stop);
};
- 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 40 (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 a Cognitive Complexity of 40 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (Posts) {
const Diffs = {};
Posts.diffs = Diffs;
Diffs.exists = async function (pid) {
if (meta.config.enablePostHistory !== 1) {
- 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 UserCommands
has a Cognitive Complexity of 40 (exceeds 10 allowed). Consider refactoring. Open
function UserCommands() {
const { argParsers, getAdminUidOrFail, setupApp } = UserCmdHelpers();
async function info({ uid, username, userslug }) {
if (!uid && !username && !userslug) {
- 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 40 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (User) {
User.getAllowedProfileImageExtensions = function () {
const exts = User.getAllowedImageTypes().map(type => mime.getExtension(type));
if (exts.includes('jpeg')) {
exts.push('jpg');
- 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 utils.common.js
has 635 lines of code (exceeds 500 allowed). Consider refactoring. Open
'use strict';
// add default escape function for escaping HTML entities
const escapeCharMap = Object.freeze({
Function exports
has a Cognitive Complexity of 39 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (User) {
User.bans = {};
User.bans.ban = async function (uid, until, reason) {
// "until" (optional) is unix timestamp in milliseconds
- 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 177 lines of code (exceeds 75 allowed). Consider refactoring. Open
module.exports = function (User) {
User.getAllowedProfileImageExtensions = function () {
const exts = User.getAllowedImageTypes().map(type => mime.getExtension(type));
if (exts.includes('jpeg')) {
exts.push('jpg');
utils
has 38 functions (exceeds 20 allowed). Consider refactoring. Open
const utils = {
// https://github.com/substack/node-ent/blob/master/index.js
decodeHTMLEntities: function (html) {
return String(html)
.replace(/&#(\d+);?/g, function (_, code) {
Function exports
has 175 lines of code (exceeds 75 allowed). Consider refactoring. Open
module.exports = function (module) {
const _ = require('lodash');
const helpers = require('./helpers');
module.setAdd = async function (key, value) {
Function exports
has a Cognitive Complexity of 38 (exceeds 10 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)));
};
- 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 170 lines of code (exceeds 75 allowed). Consider refactoring. Open
module.exports = function (Posts) {
Posts.uploads = {};
const md5 = filename => crypto.createHash('md5').update(filename).digest('hex');
const pathPrefix = path.join(nconf.get('upload_path'));
Function exports
has a Cognitive Complexity of 37 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (Posts) {
Posts.uploads = {};
const md5 = filename => crypto.createHash('md5').update(filename).digest('hex');
const pathPrefix = path.join(nconf.get('upload_path'));
- 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 165 lines of code (exceeds 75 allowed). Consider refactoring. Open
module.exports = function (Posts) {
pubsub.on('post:edit', (pid) => {
require('./cache').del(pid);
});
Function exports
has a Cognitive Complexity of 36 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (module) {
const helpers = require('./helpers');
module.listPrepend = async function (key, value) {
if (!key) {
- 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 36 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (User) {
User.isReadyToPost = async function (uid, cid) {
await isReady(uid, cid, 'lastposttime');
};
- 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 36 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (Posts) {
Posts.getUserInfoForPosts = async function (uids, uid) {
const [userData, userSettings, signatureUids] = await Promise.all([
getUserData(uids, uid),
user.getMultipleUserSettings(uids),
- 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 sorted.js
has 606 lines of code (exceeds 500 allowed). Consider refactoring. Open
'use strict';
module.exports = function (module) {
const helpers = require('./helpers');
const util = require('util');
File users.js
has 602 lines of code (exceeds 500 allowed). Consider refactoring. Open
'use strict';
define('admin/manage/users', [
'translator', 'benchpress', 'autocomplete', 'api', 'slugify', 'bootbox', 'alerts', 'accounts/invite', 'helpers', 'admin/modules/change-email',
], function (translator, Benchpress, autocomplete, api, slugify, bootbox, alerts, AccountInvite, helpers, changeEmail) {
File users.js
has 601 lines of code (exceeds 500 allowed). Consider refactoring. Open
'use strict';
const path = require('path');
const fs = require('fs').promises;