colonizers/colonizers

View on GitHub

Showing 126 of 126 total issues

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

exports.register = function(server, options, next) {
  options = Hoek.applyToDefaults(
    {
      connection: {
        server: 'localhost'
Severity: Major
Found in packages/colonizers/server/pubsub.js - About 2 hrs to fix

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

      buildable: {
        valid: function(options) {
          return options.buildable === true || options.buildable === false;
        },
    
    
    packages/colonizers-core/lib/game-objects/collections/query-clauses.js on lines 65..75
    packages/colonizers-core/lib/game-objects/collections/query-clauses.js on lines 77..87

    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 84.

    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 3 locations. Consider refactoring.
    Open

      settlement: {
        valid: function(options) {
          return options.settlement === true || options.settlement === false;
        },
    
    
    packages/colonizers-core/lib/game-objects/collections/query-clauses.js on lines 53..63
    packages/colonizers-core/lib/game-objects/collections/query-clauses.js on lines 77..87

    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 84.

    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 3 locations. Consider refactoring.
    Open

      city: {
        valid: function(options) {
          return options.city === true || options.city === false;
        },
    
    
    packages/colonizers-core/lib/game-objects/collections/query-clauses.js on lines 53..63
    packages/colonizers-core/lib/game-objects/collections/query-clauses.js on lines 65..75

    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 84.

    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

    File rooms.js has 268 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    'use strict';
    
    var Boom = require('boom');
    var Hoek = require('hoek');
    var Joi = require('joi');
    Severity: Minor
    Found in packages/colonizers/server/api/rooms.js - About 2 hrs to fix

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

      'use strict';
      
      var Joi = require('joi');
      var mongoose = require('mongoose');
      
      
      Severity: Minor
      Found in packages/colonizers/server/web/login/index.js - About 2 hrs to fix

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

          show(player) {
            if (this.isBuildable) {
              this.rect.fill(player.color);
              this.rect.opacity(0.4);
              this.rect.show();
        Severity: Major
        Found in packages/colonizers-client/lib/game/hex-edge.js and 1 other location - About 2 hrs to fix
        packages/colonizers-client/lib/game/hex-corner.js on lines 121..128

        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 82.

        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

          show(player) {
            if (this.isBuildable) {
              this.drawing.fill(player.color);
              this.drawing.opacity(0.4);
              this.group.show();
        Severity: Major
        Found in packages/colonizers-client/lib/game/hex-corner.js and 1 other location - About 2 hrs to fix
        packages/colonizers-client/lib/game/hex-edge.js on lines 74..81

        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 82.

        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 57 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        exports.register = function(server, options, next) {
          var findSession = function(criteria, callback) {
            var Session = mongoose.model('Session');
            Session.findOne(criteria)
              .populate('user')
        Severity: Major
        Found in packages/colonizers/server/auth.js - About 2 hrs to fix

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

                if (object === 'settlement') {
                  objects = this.game.board.corners.query({
                    owner: req.player,
                    settlement: true
                  });
          Severity: Major
          Found in packages/colonizers-core/lib/controller/index.js and 1 other location - About 2 hrs to fix
          packages/colonizers-core/lib/controller/index.js on lines 207..214

          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 80.

          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

                if (object === 'city') {
                  objects = this.game.board.corners.query({
                    owner: req.player,
                    city: true
                  });
          Severity: Major
          Found in packages/colonizers-core/lib/controller/index.js and 1 other location - About 2 hrs to fix
          packages/colonizers-core/lib/controller/index.js on lines 198..205

          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 80.

          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

              this.on('build-city', function(req) {
                return req.game.phase === 'playing';
              }).then(
                this.isCurrentPlayer,
                this.hasResources({ ore: 3, grain: 2 }),
          Severity: Major
          Found in packages/colonizers-core/lib/controller/index.js and 1 other location - About 2 hrs to fix
          packages/colonizers-core/lib/controller/index.js on lines 38..45

          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 79.

          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

              this.on('build-road', function(req) {
                return req.game.phase === 'playing';
              }).then(
                this.isCurrentPlayer,
                this.hasResources({ lumber: 1, brick: 1 }),
          Severity: Major
          Found in packages/colonizers-core/lib/controller/index.js and 1 other location - About 2 hrs to fix
          packages/colonizers-core/lib/controller/index.js on lines 64..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 79.

          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 initRoad has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            initRoad(req, next) {
              var board = this.game.board;
              var ownedEdges = board.edges.query({ owner: req.player });
              var distributeResources = ownedEdges.length === 1;
              var data = {};
          Severity: Minor
          Found in packages/colonizers-core/lib/controller/index.js - About 1 hr to fix

            Function onWiiuInput has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            StageNavigator.prototype.onWiiuInput = function() {
              var state = window.wiiu.gamepad.update();
              var dragX = 0;
              var dragY = 0;
              var rotate = 0;
            Severity: Minor
            Found in packages/colonizers-client/lib/stage-navigator.js - About 1 hr to fix

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

              exports.register = function(server, options, next) {
                server.route({
                  method: 'GET',
                  path: '/room/{roomId}',
                  config: {
              Severity: Minor
              Found in packages/colonizers/server/web/room/index.js - About 1 hr to fix

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

                RoomSchema.methods.toJSON = function() {
                  return {
                    id: this.id,
                    owner: this.owner,
                    users: this.users,
                Severity: Major
                Found in packages/colonizers/server/schema/room.js and 1 other location - About 1 hr to fix
                packages/colonizers/server/schema/game-event.js on lines 24..32

                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 69.

                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

                GameEventSchema.methods.toJSON = function() {
                  return {
                    id: this.id,
                    room: this.room,
                    event: this.event,
                Severity: Major
                Found in packages/colonizers/server/schema/game-event.js and 1 other location - About 1 hr to fix
                packages/colonizers/server/schema/room.js on lines 50..58

                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 69.

                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

                Consider simplifying this complex logical expression.
                Open

                  if (game && player && player.hasResources) {
                    var edges = game.getBuildableEdgesForPlayer(player);
                    var corners = game.getBuildableCornersForPlayer(player);
                    var cornerSettlements = game.getSettlementsForPlayer(player);
                
                
                Severity: Critical
                Found in packages/colonizers-client/lib/components/build-modal.js - About 1 hr to fix

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

                    showBuildableCities() {
                      var currentPlayer = this.currentPlayer;
                      var settlements = this.getSettlementsForPlayer(currentPlayer);
                  
                      settlements.forEach(function(settlement) {
                  Severity: Major
                  Found in packages/colonizers-client/lib/game/game.js and 1 other location - About 1 hr to fix
                  packages/colonizers-client/lib/game/game.js on lines 43..52

                  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 68.

                  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