File chat.js
has 1223 lines of code (exceeds 250 allowed). Consider refactoring. Open
idrinth.chat = {
/**
* own user id
* @type Number
*/
- Create a ticketCreate a ticket
Function refreshChats
has a Cognitive Complexity of 155 (exceeds 5 allowed). Consider refactoring. Open
refreshChats: function() {
/**
*
* @param {String} data
* @returns {undefined}
- Read upRead up
- Create a ticketCreate a ticket
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 refreshChats
has 314 lines of code (exceeds 25 allowed). Consider refactoring. Open
refreshChats: function() {
/**
*
* @param {String} data
* @returns {undefined}
- Create a ticketCreate a ticket
Function start
has 288 lines of code (exceeds 25 allowed). Consider refactoring. Open
start: function() {
/**
*
* @returns {HTMLElement}
*/
- Create a ticketCreate a ticket
Function build
has 240 lines of code (exceeds 25 allowed). Consider refactoring. Open
let build = function() {
/**
*
* @param {String} label
* @returns {Object}
- Create a ticketCreate a ticket
Function applyMessages
has 226 lines of code (exceeds 25 allowed). Consider refactoring. Open
let applyMessages = function(data) {
/**
*
* @param {String} messages
* @returns {undefined}
- Create a ticketCreate a ticket
Function processMessages
has 209 lines of code (exceeds 25 allowed). Consider refactoring. Open
let processMessages = function(messages) {
/**
*
* @param {Array} chatMessages
* @param {Number} chatId
- Create a ticketCreate a ticket
Function addMessages
has 159 lines of code (exceeds 25 allowed). Consider refactoring. Open
let addMessages = function(chatMessages, chatId, chatElement) {
/**
*
* @param {String} message
* @param {HTMLElement} chat
- Create a ticketCreate a ticket
Function buildMessage
has 136 lines of code (exceeds 25 allowed). Consider refactoring. Open
let buildMessage = function(message, chat, chatId, messageId) {
/**
*
* @returns {String}
*/
- Create a ticketCreate a ticket
Function userclick
has 121 lines of code (exceeds 25 allowed). Consider refactoring. Open
userclick: function(element, user, chat) {
if (
!idrinth.chat.chatRank[chat][idrinth.chat.self] ||
parseInt(user, 10) === parseInt(idrinth.chat.self, 10)
) {
- Create a ticketCreate a ticket
Function userclick
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
userclick: function(element, user, chat) {
if (
!idrinth.chat.chatRank[chat][idrinth.chat.self] ||
parseInt(user, 10) === parseInt(idrinth.chat.self, 10)
) {
- Read upRead up
- Create a ticketCreate a ticket
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 replaceInText
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
replaceInText: function(message, regex, callbacks, lastField) {
/**
*
* @param {String} message
* @param {RegExp} regex
- Read upRead up
- Create a ticketCreate a ticket
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 getPopupContent
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
let getPopupContent = function(chat, user, rankId) {
/**
*
* @param {Number} chat
* @returns {Array}
- Create a ticketCreate a ticket
Function refreshMembers
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
let refreshMembers = function() {
/**
*
* @param {String} data
* @returns {undefined}
- Create a ticketCreate a ticket
Function replaceInText
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
replaceInText: function(message, regex, callbacks, lastField) {
/**
*
* @param {String} message
* @param {RegExp} regex
- Create a ticketCreate a ticket
Function applyMembers
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
let applyMembers = function(data) {
/**
*
* @returns {undefined}
*/
- Create a ticketCreate a ticket
Function showOptions
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
showOptions: function(event, element) {
event.preventDefault();
idrinth.ui.base.appendChild(
idrinth.ui.buildElement({
type: "ul",
- Create a ticketCreate a ticket
chat
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
idrinth.chat = {
/**
* own user id
* @type Number
*/
- Create a ticketCreate a ticket
Function notify
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
let notify = function(message, own, chatId) {
/**
*
* @param {Number} chatId
* @returns {Boolean}
- Create a ticketCreate a ticket
Function applyMemberData
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
let applyMemberData = function() {
/**
*
* @param {HTMLElement} chat
* @param {Number} chatId
- Create a ticketCreate a ticket
Function getPromotionOptions
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
let getPromotionOptions = function(chat) {
let promotionModes = [
{
chat: chat,
label: "chat.actions.banUser",
- Create a ticketCreate a ticket
Function buildEmoticons
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
buildEmoticons: function(message) {
if (!idrinth.chat.emotes.lookup) {
return message;
}
let part = idrinth.core.escapeRegExp(
- Create a ticketCreate a ticket
Function start
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
start: function() {
/**
*
* @returns {HTMLElement}
*/
- Read upRead up
- Create a ticketCreate a ticket
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 complexHandler
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
let complexHandler = function(message, regex, callbacks, lastField) {
/**
*
* @param {Number} count
* @param {Array} callbacks
- Create a ticketCreate a ticket
Function loginActions
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
loginActions: function(key) {
let chatLogin,
success,
urls = {
register: "chat-service/register/",
- Create a ticketCreate a ticket
Function joinCallback
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
joinCallback: function(reply) {
if (!reply) {
idrinth.core.alert(idrinth.text.get("chat.error.join"));
return;
}
- Create a ticketCreate a ticket
Function addMemberElement
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
let addMemberElement = function(chat, chatId, userId) {
let usedPlatforms = "";
for (var pkey in idrinth.chat.users[userId].platforms) {
if (idrinth.chat.users[userId].platforms[pkey]) {
usedPlatforms += pkey;
- Create a ticketCreate a ticket
Function loginCallback
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
loginCallback: function(data) {
if (!data) {
idrinth.core.alert(idrinth.text.get("chat.error.login"));
return;
}
- Create a ticketCreate a ticket
Function setChatClass
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
let setChatClass = function(isNew, chat, chatId) {
/**
*
* @param {HTMLElement} element
* @returns {Boolean}
- Create a ticketCreate a ticket
Function buildMessageText
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
buildMessageText: function(message) {
let reg = new RegExp("(^|\\W)(https?://([^/ ]+)(/.*?)?)($| )", "ig");
return idrinth.chat.replaceInText(
message,
reg,
- Create a ticketCreate a ticket
Function openCloseChat
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
openCloseChat: function(element) {
let chat = element.parentNode;
if (
chat.getAttribute("class") === "idrinth-hovering-box active" ||
chat.getAttribute("class") === "idrinth-hovering-box active left-sided"
- Read upRead up
- Create a ticketCreate a ticket
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 partHandler
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
let partHandler = function(count, callbacks, text, textcontent) {
/**
*
* @param {Array} textcontent
* @param {Function} func
- Create a ticketCreate a ticket
Function joinCallback
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
joinCallback: function(reply) {
if (!reply) {
idrinth.core.alert(idrinth.text.get("chat.error.join"));
return;
}
- Read upRead up
- Create a ticketCreate a ticket
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 loginCallback
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
loginCallback: function(data) {
if (!data) {
idrinth.core.alert(idrinth.text.get("chat.error.login"));
return;
}
- Read upRead up
- Create a ticketCreate a ticket
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"