oglimmer/citybuilder

View on GitHub

Showing 82 of 157 total issues

Function setBaseFillStyle has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

UIElement.prototype.setBaseFillStyle = function() {
    switch(this.type) {
        case -1:/*UNKNWON*/
            this.fillStyleN = '#333333';
            break;
Severity: Major
Found in client/game/UIElement.js - About 2 hrs to fix

    File ioHandler.js has 254 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    var GameStates = require("./rule_defines.js").GameStates;
    var Field = require('./rule_field.js');
    var GameField = require('./rule_gamefield.js');
    var util = require('util');
    
    
    Severity: Minor
    Found in server/ioHandler.js - About 2 hrs to fix

      Function add has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      GameField.prototype.add = function(width, height, houseType, maxPop, localLevel) {
      
          if(this.freeRange.length == 0 ) {
              this.minX -= 3;
              this.minY -= 3;
      Severity: Minor
      Found in server/rule_gamefield.js - About 2 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 setBaseFillStyle has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      UIElement.prototype.setBaseFillStyle = function() {
          switch(this.type) {
              case -1:/*UNKNWON*/
                  this.fillStyleN = '#333333';
                  break;
      Severity: Minor
      Found in client/game/UIElement.js - About 2 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 storeGame has 50 lines of code (exceeds 25 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 2 hrs to fix

          Function InfoField has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

          function InfoField(ctx) {
              this.field = null;
              this.x = ctx.canvas.width-224;
              this.y = 60;
              this.width = 216;
          Severity: Minor
          Found in client/game/InfoField.js - About 1 hr 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 getPlayers has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              getPlayers : function(gameId, perRow, allRows) {
                  if(typeof gameId === "undefined") {
                      logger.error("Error in getPlayers - gameId is undefined");
                  }
                  db.view("game", "playersByGameId", { key : gameId }, function(err, body) {
          Severity: Minor
          Found in server/rule_playermanager.js - About 1 hr to fix

            Function baseHtmlHandler has 44 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function baseHtmlHandler (req, res) {
                var lang = req.headers["accept-language"];
                logger.debug("Lang:"+lang);
                if((/^de/).test(lang)) {
                    lang = "de";
            Severity: Minor
            Found in server/io.js - About 1 hr to fix

              Function AuctionCard has 44 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function AuctionCard(id,title,text,x,y,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 1 hr to fix

                Function Button has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                function Button(label,x, y, width, onclick) {
                    this.label = label;
                    this.width = width != null ? width : 60;
                    this.height = 20;
                    this.enabled = true;
                Severity: Minor
                Found in client/game/Button.js - About 1 hr 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 processAuctionBid has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                Game.prototype.processAuctionBid = function(allPlayers) {
                    logger.debug("[processAuctionBid] start. this.biddings=%j", this.biddings);
                
                    this.gameState = GameStates.PICK_CARD;
                    // if a player had left the game and rejoined again his bidding is undefined. So tread this as $0.
                Severity: Minor
                Found in server/rule_game.js - About 1 hr to fix

                  Function draw has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  UIElement.prototype.draw = function(ctx, relocateX, relocateY) {
                      ctx.beginPath();
                      
                      // get the background-color
                      if(this.fillStyleH != null) {
                  Severity: Minor
                  Found in client/game/UIElement.js - About 1 hr to fix

                    Function InfoField has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function InfoField(ctx) {
                        this.field = null;
                        this.x = ctx.canvas.width-224;
                        this.y = 60;
                        this.width = 216;
                    Severity: Minor
                    Found in client/game/InfoField.js - About 1 hr to fix

                      Function draw has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          this.draw = function(ctx) {  
                              ctx.beginPath();
                              ctx.rect(0,0,ctx.canvas.width,20);
                              ctx.rect(500,0,0,20);
                              ctx.fillStyle = '#8ED6FF';
                      Severity: Minor
                      Found in client/game/InfoBar.js - About 1 hr to fix

                        Function Card has 10 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        function Card(id,title,text,actionBit,playType,profitConfig,range,localLevelMod,type,ctx) {
                        Severity: Major
                        Found in client/game/Card.js - About 1 hr to fix

                          Function forEachField has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                          Card.forEachField = function(range, field, fields, perField) {
                              for(var x = -range ; x <= range ; x++) {
                                  for(var y = -range ; y <= range ; y++) {
                                      if(x!=0 || y!=0) {
                                          var surroundingElement = fields[(field.x+x)+":"+(field.y+y)];
                          Severity: Minor
                          Found in server/cards/card_basecards.js - About 1 hr 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 AuctionCard has 10 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          function AuctionCard(id,title,text,x,y,profitConfig,range,localLevelMod,type,ctx) {
                          Severity: Major
                          Found in client/game/Card.js - About 1 hr to fix

                            Function draw has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                this.draw = function(ctx) {  
                                    ctx.font = '12px Arial';
                                    ctx.beginPath();
                                    ctx.rect(this.x,this.y,this.width,this.height);
                                    if(this.clicked) {
                            Severity: Minor
                            Found in client/game/Card.js - About 1 hr to fix

                              Function Button has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function Button(label,x, y, width, onclick) {
                                  this.label = label;
                                  this.width = width != null ? width : 60;
                                  this.height = 20;
                                  this.enabled = true;
                              Severity: Minor
                              Found in client/game/Button.js - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language