Showing 165 of 254 total issues
Function DesktopMenu
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
const DesktopMenu: FunctionComponent = () => {
const navigate = useNavigate();
const { windowStore, profileStore } = useContext(ServerContext);
const handleLogout = (allSessions: boolean) => windowStore.handleLogout(allSessions);
Function connect
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
function connect(userId, nick, network) {
if (sockets[`${userId}:${network}`]) {
log.warn({ id: userId }, `Impossible happened. Already connected to IRC network: ${network}`);
return;
}
Function handlePrivmsg
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function handlePrivmsg(user, msg, command) {
// :ilkkao!~ilkkao@127.0.0.1 NOTICE buppe :foo
const target = msg.params[0];
const currentNick = await nicksService.getNick(user.gId, msg.network);
let conversation;
Function scanMentions
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.scanMentions = async function scanMentions(conversation, message) {
if (!message.get('userGId') || message.get('userGId') === 'i0' || !message.get('body')) {
return;
}
Function configTransports
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
function configTransports() {
const transports = [];
if (get('log:file')) {
let logDirectory = path.normalize(get('log:directory'));
Function Search
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Search: FunctionComponent = () => {
const navigate = useNavigate();
const toast = useToast();
const { windowStore } = useContext(ServerContext);
const [name, setName] = useState<string>('');
Function constructor
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor({
id,
peerUser,
network,
operators,
Function sendNotifications
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
async function sendNotifications(user, sessionId, excludeSessionId, ntfs) {
assert(ntfs);
const ntfsArray = (util.isArray(ntfs) ? ntfs : [ntfs]).map(ntf =>
typeof ntf === 'string' ? ntf : JSON.stringify(ntf)
- 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 _drawCursor
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
_drawCursor(cursor) {
if (cursor.x === null) {
$('#window-cursor').hide();
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 buildRouter
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function buildRouter() {
log.info('Registering app routes');
const router = new Router();
Function createWindow
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function createWindow(user, conversation) {
let peerMember = null;
assert(conversation);
Function _parseLinks
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
_parseLinks(text) {
const imgSuffixes = ['png', 'jpg', 'jpeg', 'gif', 'webp'];
const media = [];
let body = '';
Function handleJoin
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function handleJoin(user, msg) {
// :neo!i=ilkkao@iao.iki.fi JOIN :#testi4
const channel = msg.params[0];
const network = msg.network;
const targetUser = await nicksService.getUser(msg.nick, network);
Function handlerServerNotification
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
handlerServerNotification(ntf: Notification): boolean {
switch (ntf.type) {
case 'ADD_MESSAGE': {
const { type: _, windowId, ...message } = ntf;
this.addMessage(windowId, message);
Function process
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
exports.process = async function process(session, command) {
const { windowId } = command;
const network = typeof command.network === 'string' ? command.network.toLowerCase() : null;
const user = session.user;
- 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 constructor
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(rootStore: RootStore) {
this.rootStore = rootStore;
this.emitInit();
Function setters
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
static get setters() {
return {
name: function name(realName) {
if (!realName || realName.length < 6) {
return { valid: false, error: 'Please enter at least 6 characters.' };
Function handleUpdate
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
async function handleUpdate({ user, command, window, session }) {
const accepted = ['row', 'column', 'minimizedNamesList', 'desktop'];
const acceptedAlerts = ['email', 'notification', 'sound', 'title'];
if (!window) {
- 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 _markWindow
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
_markWindow(masWindow, x, y, cursor) {
masWindow.cursor = 'none';
const rowCount = this.dimensions.length;
const columnCount = 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"
Further reading
Function parseIrcMessage
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
async function parseIrcMessage({ userId, line, network }) {
const parts = line.trim().split(' ');
const msg = {
params: [],
numericReply: false,
- 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"