Showing 441 of 550 total issues
Function exports
has a Cognitive Complexity of 35 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (Plugins) {
async function registerPluginAssets(pluginData, fields) {
function add(dest, arr) {
dest.push(...(arr || []));
}
- 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 35 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (Messaging) {
Messaging.sendMessage = async (data) => {
await Messaging.checkContent(data.content);
const inRoom = await Messaging.isUserInRoom(data.uid, data.roomId);
if (!inRoom) {
- 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 159 lines of code (exceeds 75 allowed). Consider refactoring. Open
module.exports = function (Categories) {
Categories.getRecentReplies = async function (cid, uid, start, stop) {
// backwards compatibility, treat start as count
if (stop === undefined && start > 0) {
winston.warn('[Categories.getRecentReplies] 3 params deprecated please use Categories.getRecentReplies(cid, uid, start, stop)');
Function exports
has a Cognitive Complexity of 34 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (SocketTopics) {
SocketTopics.isTagAllowed = async function (socket, data) {
if (!data || !utils.isNumber(data.cid) || !data.tag) {
throw new Error('[[error:invalid-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 34 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (module) {
const helpers = require('./helpers');
module.flushdb = async function () {
await module.client.dropDatabase();
};
- 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 34 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (Posts) {
Posts.urlRegex = {
regex: /href="([^"]+)"/g,
length: 6,
};
- 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 154 lines of code (exceeds 75 allowed). Consider refactoring. Open
tagFilter.init = function (el, options) {
if (!el || !el.length) {
return;
}
options = options || {};
Function exports
has a Cognitive Complexity of 33 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (module) {
const helpers = require('./helpers');
module.flushdb = async function () {
await module.pool.query(`DROP SCHEMA "public" CASCADE`);
- 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 33 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (User) {
const filterFnMap = {
online: user => user.status !== 'offline' && (Date.now() - user.lastonline < 300000),
flagged: user => parseInt(user.flags, 10) > 0,
verified: user => !!user['email:confirmed'],
- 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 parse
has 152 lines of code (exceeds 75 allowed). Consider refactoring. Open
Tags.parse = async (req, data, meta, link) => {
// Meta tags
const defaultTags = [{
name: 'viewport',
content: 'width=device-width, initial-scale=1.0',
Function exports
has 152 lines of code (exceeds 75 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) {
Consider simplifying this complex logical expression. Open
if (post) {
post.topicOwnerPost = parseInt(topicData.uid, 10) === parseInt(post.uid, 10);
post.display_edit_tools = topicPrivileges.isAdminOrMod || (post.selfPost && topicPrivileges['posts:edit']);
post.display_delete_tools = topicPrivileges.isAdminOrMod || (post.selfPost && topicPrivileges['posts:delete']);
post.display_moderator_tools = post.display_edit_tools || post.display_delete_tools;
Function exports
has 149 lines of code (exceeds 75 allowed). Consider refactoring. Open
module.exports = function (User) {
const spiderDefaultSettings = {
usePagination: 1,
topicPostSort: 'oldest_to_newest',
postsPerPage: 20,
Function exports
has a Cognitive Complexity of 32 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (Groups) {
Groups.join = async function (groupNames, uid) {
if (!groupNames) {
throw new Error('[[error:invalid-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 getUsers
has a Cognitive Complexity of 32 (exceeds 10 allowed). Consider refactoring. Open
async function getUsers(req, res) {
const sortDirection = req.query.sortDirection || 'desc';
const reverse = sortDirection === 'desc';
const page = parseInt(req.query.page, 10) || 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 exports
has a Cognitive Complexity of 32 (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 getTopic
has a Cognitive Complexity of 32 (exceeds 10 allowed). Consider refactoring. Open
topicsController.get = async function getTopic(req, res, next) {
const tid = req.params.topic_id;
if (
(req.params.post_index && !utils.isNumber(req.params.post_index) && req.params.post_index !== 'unread') ||
!utils.isNumber(tid)
- 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 32 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (User) {
const spiderDefaultSettings = {
usePagination: 1,
topicPostSort: 'oldest_to_newest',
postsPerPage: 20,
- 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 32 (exceeds 10 allowed). Consider refactoring. Open
module.exports = function (Categories) {
Categories.getRecentReplies = async function (cid, uid, start, stop) {
// backwards compatibility, treat start as count
if (stop === undefined && start > 0) {
winston.warn('[Categories.getRecentReplies] 3 params deprecated please use Categories.getRecentReplies(cid, uid, 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 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"