oglimmer/citybuilder

View on GitHub
client/game/ServerCommListener.js

Summary

Maintainability
D
2 days
Test Coverage

Function ServerCommListener has 251 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function ServerCommListener() {    
    var time = null;
    this.showWaitOverlay = function() {
        $('#overlay').show();
        time = new Date();
Severity: Major
Found in client/game/ServerCommListener.js - About 1 day to fix

    Function ServerCommListener has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

    function ServerCommListener() {    
        var time = null;
        this.showWaitOverlay = function() {
            $('#overlay').show();
            time = new Date();
    Severity: Minor
    Found in client/game/ServerCommListener.js - About 5 hrs 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

    File ServerCommListener.js has 253 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* ------------------------------------------ */
    /* class ServerCommListener */
    /* ------------------------------------------ */
    function ServerCommListener() {    
        var time = null;
    Severity: Minor
    Found in client/game/ServerCommListener.js - About 2 hrs to fix

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

          this.onTurnDone = function() {
              this.showWaitOverlay();
              G.turnDoneButton.enabled = false;        
              if(G.gameState == 1) {
                  socket.emit('roundEnd_req', { playerId : G.playerId});
      Severity: Minor
      Found in client/game/ServerCommListener.js - About 1 hr to fix

        There are no issues that match your filters.

        Category
        Status