oglimmer/citybuilder

View on GitHub

Showing 82 of 157 total issues

Function FieldPane has a Cognitive Complexity of 131 (exceeds 5 allowed). Consider refactoring.
Open

function FieldPane() {

    this.relocateX = 0;  
    this.relocateY = 0;
    this.allElements = [];
Severity: Minor
Found in client/game/FieldPane.js - About 2 days 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 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 exports has 248 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function(io, logger) {
    
        io.sockets.on('connection', function (socket) {
            /* A client creates a new game, joins it and waits for other players */
            socket.on('createGame_req', function (data) {
    Severity: Major
    Found in server/ioHandler.js - About 1 day to fix

      Function drawText has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
      Open

      BaseCard.drawText = function(ctx,text,profitConfig,x,y,width) {
          if(typeof(profitConfig) !== 'undefined') {
              for(var i = 0 ; i < profitConfig.length ; i++) {
                  var pf = profitConfig[i];
                  if(text.length > 0 ) {
      Severity: Minor
      Found in client/game/Card.js - About 1 day 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 rule_game.js has 483 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      var Player = require("./rule_player.js");
      var CardStack = require("./rule_cardstack.js");
      var GameField = require('./rule_gamefield.js');
      var Field = require('./rule_field.js');
      var CardFactory = require('./rule_cardfactory.js');
      Severity: Minor
      Found in server/rule_game.js - About 7 hrs to fix

        Function CardLayouter has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
        Open

        function CardLayouter(ctx) {
        
            this.cards = [];
            this.maxWidth = 600;
            this.currentlyExpanded = null;
        Severity: Minor
        Found in client/game/CardLayouter.js - About 7 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

        Function FieldPane has 173 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function FieldPane() {
        
            this.relocateX = 0;  
            this.relocateY = 0;
            this.allElements = [];
        Severity: Major
        Found in client/game/FieldPane.js - About 6 hrs to fix

          Function AuctionPanel has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
          Open

          function AuctionPanel() {
              this.cards = [];
              this.currentlyClicked = null;
              this.selectable = false;
              this.setCards = function(cards) {
          Severity: Minor
          Found in client/game/AuctionPanel.js - About 6 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

          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

          Function InfoBar has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
          Open

          function InfoBar() {
              this.money = -1;
              this.currentDate;
              this.playerNumber = -1;
              this.showLargeInfo = false;    
          Severity: Minor
          Found in client/game/InfoBar.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

          Function storeGame has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
          Open

              storeGame : function(game, prepare, onSuccess, onFail) {
                  var prepareAndInsert = function(newGame, directInsert) {
                      try {
                          var doInsert = true;
                          if(prepare != null) {
          Severity: Minor
          Found in server/rule_gamemanager.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

          Function Card has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

          function Card(id,title,text,actionBit,playType,profitConfig,range,localLevelMod,type,ctx) {
              this.Inherits(BaseCard);
              this.id = id;
              this.title = title;
              this.text = text;
          Severity: Minor
          Found in client/game/Card.js - About 3 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

          Function CardLayouter has 87 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function CardLayouter(ctx) {
          
              this.cards = [];
              this.maxWidth = 600;
              this.currentlyExpanded = null;
          Severity: Major
          Found in client/game/CardLayouter.js - About 3 hrs to fix

            Function Card has 82 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function Card(id,title,text,actionBit,playType,profitConfig,range,localLevelMod,type,ctx) {
                this.Inherits(BaseCard);
                this.id = id;
                this.title = title;
                this.text = text;
            Severity: Major
            Found in client/game/Card.js - About 3 hrs to fix

              Function removeCardFromAuction has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
              Open

              Game.prototype.removeCardFromAuction = function(cardId, playerId) {
                  var c = null;
                  if(this.gameState == GameStates.PICK_CARD) {
                      for(var i = 0 ; i < this.cardsToAuction.length ; i++) {
                          if(this.cardsToAuction[i].id == cardId) {
              Severity: Minor
              Found in server/rule_game.js - About 3 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

              Function drawText has 75 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              BaseCard.drawText = function(ctx,text,profitConfig,x,y,width) {
                  if(typeof(profitConfig) !== 'undefined') {
                      for(var i = 0 ; i < profitConfig.length ; i++) {
                          var pf = profitConfig[i];
                          if(text.length > 0 ) {
              Severity: Major
              Found in client/game/Card.js - About 3 hrs to fix

                Function Global has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function Global() {
                    this.canvas = document.getElementById('gameCanvas');
                    this.ctx = this.canvas.getContext('2d');
                    this.uiMode = 0;
                    this.playerId = null; // identifier, secret
                Severity: Major
                Found in client/game/Global.js - About 2 hrs to fix

                  Function InfoBar has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function InfoBar() {
                      this.money = -1;
                      this.currentDate;
                      this.playerNumber = -1;
                      this.showLargeInfo = false;    
                  Severity: Major
                  Found in client/game/InfoBar.js - About 2 hrs to fix

                    Function AuctionPanel has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function AuctionPanel() {
                        this.cards = [];
                        this.currentlyClicked = null;
                        this.selectable = false;
                        this.setCards = function(cards) {
                    Severity: Major
                    Found in client/game/AuctionPanel.js - About 2 hrs to fix

                      Function GlobalListeners has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function GlobalListeners() {
                      
                          this.buttonDown = false;
                          this.moved = false;
                          this.startMoveX=0;
                      Severity: Major
                      Found in client/game/GlobalListeners.js - About 2 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language