public_html/js/own_components/index.js
File index.js
has 584 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
var JSE = null;
var socket = null;
var SOCKETIO_URL = "";
Function getMessageChatTemplate
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function getMessageChatTemplate(username, message, isMe, isUnread, isFile)
{
var alignClass = "align-right";
var myMessage = "message my-message";
var otherMessage = "message other-message float-right";
Function uploadFile
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function uploadFile(evt)
{
var f = evt.target.files[0];
var reader = new FileReader();
Function onload
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
reader.onload = (function(theFile) {
return function(e) {
var username = $("#chatWith").html();
Function getMessageChatTemplate
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function getMessageChatTemplate(username, message, isMe, isUnread, isFile)
Function renderChatMessages
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
function renderChatMessages(messages, username)
{
markAsRead(username);
var user = searchUserInfoOnCache(username);
$("#chatWindow").html("");
- 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 newMessageRecived
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
function newMessageRecived(data)
{
if(!searchUserInfoOnCache(data.username))
{
- 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"