Showing 165 of 254 total issues
Function disconnectIfIdle
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
async function disconnectIfIdle(user, network) {
const windows = await windowsService.getWindowsForNetwork(user, network);
let onlyServer1on1Left = false;
if (windows.length === 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 processLine
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
processLine(window: WindowModel, body: string, doc: RemirrorJSON): void {
let command;
let commandParams;
if (body.charAt(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 moveWindow
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
moveWindow(movingWindow: Window, direction: WindowMoveDirection): void {
const windowRowIndex = this.visibleWindowsGrid.findIndex(row => row.includes(movingWindow));
const windowRow = this.visibleWindowsGrid[windowRowIndex];
if (!windowRow) {
- 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
Avoid deeply nested control flow statements. Open
if (oper === '+') {
// Non-oper got voice
newClass = VOICE;
} else {
// Non-oper lost voice
Function handleJoin
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async function handleJoin({ user, command, backend, network }) {
if (!command.name || !command.network) {
return { status: 'PARAMETER_MISSING', errorMsg: 'Name or network missing.' };
}
- 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 broadcast
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async function broadcast(conversation, ntf, excludeSession, options = {}) {
const members = await ConversationMember.find({ conversationId: conversation.id });
for (const member of members) {
const userGId = UserGId.create(member.get('userGId'));
- 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
Avoid deeply nested control flow statements. Open
if (re) {
inSeconds = parseInt(re[1] || 0) * 3600 + parseInt(re[2] || 0) * 60 + parseInt(re[3] || 0);
}
Function deleteConversationMember
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async function deleteConversationMember(conversation, member, options) {
log.info(`User: ${member.get('userGId')} removed from conversation: ${conversation.id}`);
if (!options.silent && conversation.get('type') === 'group') {
await broadcastAddMessage(conversation, {
- 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
Avoid deeply nested control flow statements. Open
for (const network of networks) {
const currentNick = await nicksService.getNick(foundUser.gId, network);
// Fallback to default nick. This solves the situation where the user joins
// a new IRC network during the session. In that case his own userGId is in
Avoid deeply nested control flow statements. Open
for (const network of networks) {
entry.nick[network] = 'UNKNOWN';
}
Function sendUpdateFriendsNtf
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async function sendUpdateFriendsNtf(user, sessionId) {
const command = {
type: 'UPDATE_FRIENDS',
reset: true,
friends: []
- 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
Consider simplifying this complex logical expression. Open
} else if (
cursor.y === y &&
((section === 'right' && cursor.x === x) || (x < columnCount - 1 && cursor.x - 1 === x && section === 'left'))
) {
masWindow.cursor = 'right';
Consider simplifying this complex logical expression. Open
} else if (
cursor.y === y &&
((section === 'left' && cursor.x === x) || (x > 0 && cursor.x === x - 1 && section === 'right'))
) {
masWindow.cursor = 'left';
Function disconnectInactiveIRCUsers
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async function disconnectInactiveIRCUsers() {
log.info('Running disconnectInactiveIRCUsers job');
const cutOffDate = new Date();
cutOffDate.setDate(cutOffDate.getDate() - conf.get('irc:inactivity_timeout'));
- 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 _whichSection
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
_whichSection(windowDim, x, y) {
// -----------------
// |\ t /|
// | \ / |
// | ----------- |
- 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 _goToBottom
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
_goToBottom(animate, callback) {
if (this.scrollLock || !this.$messagesEndAnchor) {
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 processCookie
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
exports.processCookie = async function processCookie(ctx, next) {
ctx.mas = ctx.mas || {};
ctx.mas.user = null;
const sessionCookie = ctx.cookies.get('mas');
- 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 dispatch
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function dispatch(type, data = {}, acceptCb = noopCb, rejectCb = noopCb) {
let consumed = false;
const name = type
.split('_')
.map(part => part.toLowerCase().capitalize())
- 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 _addScrollHandler
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
_addScrollHandler() {
const handler = function () {
if (this.animating) {
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 _calculateSpaceForCursor
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
_calculateSpaceForCursor(x, y, cursor) {
let width = Math.round(CURSORWIDTH / 2);
const rows = this.dimensions.length;
const columns = this.dimensions[y].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"