colonizers/colonizers

View on GitHub

Showing 126 of 126 total issues

Function register has 260 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.register = function(server, options, next) {
  server.route({
    method: 'GET',
    path: '/logout',
    config: {
Severity: Major
Found in packages/colonizers/server/web/login/index.js - About 1 day to fix

    Function register has 258 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    exports.register = function(server, options, next) {
      options = Hoek.applyToDefaults({ basePath: '' }, options);
    
      var broadcastUsers = function(roomId) {
        var Room = mongoose.model('Room');
    Severity: Major
    Found in packages/colonizers/server/api/rooms.js - About 1 day to fix

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

      module.exports = {
        board: {
          bgcolor: '#f1f1f2',
          tilespacing: 8
        },
      Severity: Major
      Found in packages/colonizers-client/tilesets/modern/_.js and 1 other location - About 1 day to fix
      packages/colonizers-client/tilesets/watercolor/_.js on lines 1..50

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 216.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

      module.exports = {
        board: {
          bgcolor: '#f1f1f2',
          tilespacing: 8
        },
      Severity: Major
      Found in packages/colonizers-client/tilesets/watercolor/_.js and 1 other location - About 1 day to fix
      packages/colonizers-client/tilesets/modern/_.js on lines 1..50

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 216.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Function register has 128 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      exports.register = function(server, options, next) {
        options = Hoek.applyToDefaults({ basePath: '' }, options);
      
        var io = server.plugins['hapi-io'].io;
      
      
      Severity: Major
      Found in packages/colonizers/server/api/games.js - About 5 hrs to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                {
                  assign: 'usernameCheck',
                  method: function(request, reply) {
                    var User = mongoose.model('User');
        
        
        Severity: Major
        Found in packages/colonizers/server/web/login/index.js and 1 other location - About 5 hrs to fix
        packages/colonizers/server/web/login/index.js on lines 229..255

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 137.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                {
                  assign: 'emailCheck',
                  method: function(request, reply) {
                    var User = mongoose.model('User');
                    var conditions = {
        Severity: Major
        Found in packages/colonizers/server/web/login/index.js and 1 other location - About 5 hrs to fix
        packages/colonizers/server/web/login/index.js on lines 201..228

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 137.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          buildSettlement(req, next) {
            var buildableSpots = this.game.getBuildableCornersForPlayer(req.player);
        
            var validSpot = buildableSpots.some(function(corner) {
              return corner.id === req.data.buildId;
        Severity: Major
        Found in packages/colonizers-core/lib/controller/index.js and 1 other location - About 4 hrs to fix
        packages/colonizers-core/lib/controller/index.js on lines 224..240

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 130.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          buildRoad(req, next) {
            var buildableSpots = this.game.getBuildableEdgesForPlayer(req.player);
        
            var validSpot = buildableSpots.some(function(edge) {
              return edge.id === req.data.buildId;
        Severity: Major
        Found in packages/colonizers-core/lib/controller/index.js and 1 other location - About 4 hrs to fix
        packages/colonizers-core/lib/controller/index.js on lines 242..258

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 130.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Function getScenario has 112 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          getScenario() {
            var circumradius = hexInfo.circumradius;
            var apothem = hexInfo.apothem;
            var layout = this.getLayout();
            var numberTokens = layout.numberTokens;
        Severity: Major
        Found in packages/colonizers-core/lib/scenario-builder.js - About 4 hrs to fix

          Function register has 90 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          exports.register = function(server, options, next) {
            options = Hoek.applyToDefaults({ basePath: '' }, options);
          
            server.route({
              method: 'GET',
          Severity: Major
          Found in packages/colonizers/server/api/sessions.js - About 3 hrs to fix

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            BuildModalModel.prototype.onBuildRoad = function(data, next) {
              var thisPlayer = this.roomModel.thisPlayer;
            
              if (thisPlayer && thisPlayer.id === data.playerId) {
                this.allowanceRoads = this.allowanceRoads - 1;
            Severity: Major
            Found in packages/colonizers-client/lib/components/build-modal.js and 1 other location - About 3 hrs to fix
            packages/colonizers-client/lib/components/build-modal.js on lines 127..136

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 95.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            BuildModalModel.prototype.onBuildSettlement = function(data, next) {
              var thisPlayer = this.roomModel.thisPlayer;
            
              if (thisPlayer && thisPlayer.id === data.playerId) {
                this.allowanceSettlements = this.allowanceSettlements - 1;
            Severity: Major
            Found in packages/colonizers-client/lib/components/build-modal.js and 1 other location - About 3 hrs to fix
            packages/colonizers-client/lib/components/build-modal.js on lines 116..125

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 95.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

            exports.register = function(server, options, next) {
              options = Hoek.applyToDefaults({ basePath: '' }, options);
            
              server.route({
                method: 'GET',
            Severity: Major
            Found in packages/colonizers/server/api/account.js - About 3 hrs to fix

              Function register has 73 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              exports.register = function(server, options, next) {
                server.route({
                  method: 'GET',
                  path: '/bundles/{param*}',
                  config: {
              Severity: Major
              Found in packages/colonizers/server/assets.js - About 2 hrs to fix

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

                'use strict';
                
                var BaseController = require('./base');
                
                module.exports = class Controller extends BaseController {
                Severity: Minor
                Found in packages/colonizers-core/lib/controller/index.js - About 2 hrs to fix

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                        return _.chain(edges)
                          .map(function(edge) {
                            return edge.getAdjacentEdges();
                          })
                          .flatten(true)
                  Severity: Major
                  Found in packages/colonizers-core/lib/game-objects/game.js and 1 other location - About 2 hrs to fix
                  packages/colonizers-core/lib/game-objects/game.js on lines 134..145

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 92.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                        return _.chain(edges)
                          .map(function(edge) {
                            return edge.getAdjacentCorners();
                          })
                          .flatten(true)
                  Severity: Major
                  Found in packages/colonizers-core/lib/game-objects/game.js and 1 other location - About 2 hrs to fix
                  packages/colonizers-core/lib/game-objects/game.js on lines 100..111

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 92.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                    buildSettlement(player) {
                      var corners = this.getAdjacentCorners();
                  
                      this.owner = player.id;
                      this.isBuildable = false;
                  Severity: Major
                  Found in packages/colonizers-core/lib/game-objects/hex-corner.js and 1 other location - About 2 hrs to fix
                  packages/colonizers-core/lib/game-objects/hex-corner.js on lines 73..83

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 88.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                    buildCity(player) {
                      var corners = this.getAdjacentCorners();
                  
                      this.owner = player.id;
                      this.isBuildable = false;
                  Severity: Major
                  Found in packages/colonizers-core/lib/game-objects/hex-corner.js and 1 other location - About 2 hrs to fix
                  packages/colonizers-core/lib/game-objects/hex-corner.js on lines 61..71

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 88.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Severity
                  Category
                  Status
                  Source
                  Language