Showing 165 of 254 total issues
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 decoratedTitle
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
get decoratedTitle(): string {
let title = '';
const type = this.type;
const network = this.network;
const name = this.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 newMessageAlert
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private newMessageAlert(window: WindowModel, message: Message) {
if (!message.isNotable || message.isFromMe || !this.initDone) {
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
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return courier.call(backend, 'textCommand', {
userId: user.id,
conversationId: conversation.id,
command: name,
commandParams: params
Avoid too many return
statements within this function. Open
return message.body;
Avoid too many return
statements within this function. Open
return { status: 'OK' };
Avoid too many return
statements within this function. Open
return start1on1(user, targetUserGId, targetUserGId.isMASUser ? 'mas' : network);
Avoid too many return
statements within this function. Open
return { valid: true, value: nickName };
Avoid too many return
statements within this function. Open
return { status: 'OK' };
Avoid too many return
statements within this function. Open
return <Text color="red.600">{message.body}</Text>;
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return { status: 'ERROR', errorMsg: 'Nick missing, use e.g. /ircquery john' };
Avoid too many return
statements within this function. Open
return 'left'; // l
Function findOrCreate1on1
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
exports.findOrCreate1on1 = async function findOrCreate1on1(user, peerUserGId, network) {
assert(user && peerUserGId && network);
let conversation = null;
const userMembers = await ConversationMember.find({ userGId: user.gIdString });
- 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 setGroupMembers
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
exports.setGroupMembers = async function setGroupMembers(conversation, newMembersHash) {
const oldMembers = await ConversationMember.find({ conversationId: conversation.id });
for (const oldMember of oldMembers) {
if (!Object.keys(newMembersHash).some(newMember => newMember === oldMember.gIdString)) {
- 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 verifyPassword
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
async verifyPassword(password) {
const encryptedPassword = this.get('password');
const encryptionMethod = this.get('passwordType');
if (!encryptedPassword) {
- 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 a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
exports.init = async function init(user, session, maxBacklogLines, cachedUpto) {
await settingsService.sendUpdateSettings(user, session.id);
await friendsService.sendUpdateFriends(user, session.id);
await friendsService.sendConfirmFriends(user, session.id);
await friendsService.informStateChange(user, 'login');
- 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 didInsertElement
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
didInsertElement() {
this.sendAction('register', this);
this.set('elementInserted', true);
this.$messagePanel = this.$('.window-messages');
- 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"