segura2010/CC-Proyecto-OpenSecureChat

View on GitHub
public_html/js/own_components/index.js

Summary

Maintainability
D
1 day
Test Coverage

File index.js has 584 lines of code (exceeds 250 allowed). Consider refactoring.
Open


var JSE = null;
var socket = null;

var SOCKETIO_URL = "";
Severity: Major
Found in public_html/js/own_components/index.js - About 1 day to fix

    Function getMessageChatTemplate has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function getMessageChatTemplate(username, message, isMe, isUnread, isFile)
    {
        var alignClass = "align-right";
        var myMessage = "message my-message";
        var otherMessage = "message other-message float-right";
    Severity: Minor
    Found in public_html/js/own_components/index.js - About 1 hr to fix

      Function uploadFile has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function uploadFile(evt)
      {
          var f = evt.target.files[0];
      
          var reader = new FileReader();
      Severity: Minor
      Found in public_html/js/own_components/index.js - About 1 hr to fix

        Function onload has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            reader.onload = (function(theFile) {
                return function(e) {
        
                    var username = $("#chatWith").html();
        
        
        Severity: Minor
        Found in public_html/js/own_components/index.js - About 1 hr to fix

          Function getMessageChatTemplate has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          function getMessageChatTemplate(username, message, isMe, isUnread, isFile)
          Severity: Minor
          Found in public_html/js/own_components/index.js - About 35 mins to fix

            Function renderChatMessages has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            function renderChatMessages(messages, username)
            {
                markAsRead(username);
                var user = searchUserInfoOnCache(username);
                $("#chatWindow").html("");
            Severity: Minor
            Found in public_html/js/own_components/index.js - About 25 mins to fix

            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

            function newMessageRecived(data)
            {
            
                if(!searchUserInfoOnCache(data.username))
                {
            Severity: Minor
            Found in public_html/js/own_components/index.js - About 25 mins to fix

            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

            There are no issues that match your filters.

            Category
            Status