colonizers/colonizers

View on GitHub

Showing 126 of 126 total issues

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

gulp.task('styles', function() {
  return gulp
    .src(['./less/game.less'])
    .pipe(less())
    .pipe(gulp.dest('./public/css'));
Severity: Major
Found in packages/colonizers-client/gulpfile.js and 1 other location - About 1 hr to fix
packages/colonizers/gulpfile.js on lines 12..17

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

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

  onStageTransform(transform) {
    var offset;

    if (this.transforming) {
      return;
Severity: Minor
Found in packages/colonizers-client/lib/game/board.js - About 1 hr to fix

    Function next has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function next() {
          $active
            .removeClass('active')
            .find('> .dropdown-menu > .active')
              .removeClass('active')
    Severity: Minor
    Found in packages/colonizers/server/assets/js/jquery-plugins.js - About 1 hr to fix

      Function getTasks has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        getTasks(event, data) {
          var listeners = this.callbacks[event] || [];
      
          var pres = this._pre.slice(0).map(function(pre) {
            return function(next) {
      Severity: Minor
      Found in packages/colonizers-core/lib/emitter-queue.js - About 1 hr to fix

        Function distributeResources has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          distributeResources(req, diceTotal, next) {
            var data = {};
            var tiles = this.game.board.tiles.query({ value: diceTotal });
        
            this.game.players.forEach(function(player) {
        Severity: Minor
        Found in packages/colonizers-core/lib/controller/index.js - About 1 hr to fix

          Function constructor has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            constructor(options, done) {
              var factory = options.factory || new Factory();
          
              this.gameSerializer = new GameSerializer(factory);
              this.game = this.gameSerializer.deserialize(options.game);
          Severity: Minor
          Found in packages/colonizers-core/lib/game-context.js - About 1 hr to fix

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

                this.rect.on('mouseover', () => {
                  return $(this.rect.getStage().container()).addClass('clickable');
                });
            Severity: Minor
            Found in packages/colonizers-client/lib/game/hex-edge.js and 1 other location - About 55 mins to fix
            packages/colonizers-client/lib/game/hex-edge.js on lines 44..46

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

            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.rect.on('mouseout', () => {
                  return $(this.rect.getStage().container()).removeClass('clickable');
                });
            Severity: Minor
            Found in packages/colonizers-client/lib/game/hex-edge.js and 1 other location - About 55 mins to fix
            packages/colonizers-client/lib/game/hex-edge.js on lines 40..42

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

            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.drawing.on('mouseout', () => {
                  $(this.drawing.getStage().container()).removeClass('clickable');
                });
            Severity: Minor
            Found in packages/colonizers-client/lib/game/hex-corner.js and 1 other location - About 55 mins to fix
            packages/colonizers-client/lib/game/hex-corner.js on lines 33..35

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

            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.drawing.on('mouseover', () => {
                  $(this.drawing.getStage().container()).addClass('clickable');
                });
            Severity: Minor
            Found in packages/colonizers-client/lib/game/hex-corner.js and 1 other location - About 55 mins to fix
            packages/colonizers-client/lib/game/hex-corner.js on lines 37..39

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

            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 getDataForTurn has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

              getDataForTurn(turn) {
                var phase = 'waiting';
                var playerIndex = null;
                var prevTurn;
            
            
            Severity: Minor
            Found in packages/colonizers-core/lib/game-objects/game.js - About 55 mins 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

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

            BuildModalModel.prototype.buildSettlement = function() {
              $('#buildModal').modal('hide');
              this.roomModel.game.showBuildableSettlements();
            };
            Severity: Major
            Found in packages/colonizers-client/lib/components/build-modal.js and 2 other locations - About 55 mins to fix
            packages/colonizers-client/lib/components/build-modal.js on lines 150..153
            packages/colonizers-client/lib/components/build-modal.js on lines 160..163

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

            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

            BuildModalModel.prototype.buildRoad = function() {
              $('#buildModal').modal('hide');
              this.roomModel.game.showBuildableEdges();
            };
            Severity: Major
            Found in packages/colonizers-client/lib/components/build-modal.js and 2 other locations - About 55 mins to fix
            packages/colonizers-client/lib/components/build-modal.js on lines 155..158
            packages/colonizers-client/lib/components/build-modal.js on lines 160..163

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

            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

            BuildModalModel.prototype.buildCity = function() {
              $('#buildModal').modal('hide');
              this.roomModel.game.showBuildableCities();
            };
            Severity: Major
            Found in packages/colonizers-client/lib/components/build-modal.js and 2 other locations - About 55 mins to fix
            packages/colonizers-client/lib/components/build-modal.js on lines 150..153
            packages/colonizers-client/lib/components/build-modal.js on lines 155..158

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

            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

              server.route({
                method: 'GET',
                path: '/css/{param*}',
                config: {
                  auth: false
            Severity: Minor
            Found in packages/colonizers/server/assets.js and 1 other location - About 55 mins to fix
            packages/colonizers/server/assets.js on lines 30..41

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

            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

              server.route({
                method: 'GET',
                path: '/fonts/{param*}',
                config: {
                  auth: false
            Severity: Minor
            Found in packages/colonizers/server/assets.js and 1 other location - About 55 mins to fix
            packages/colonizers/server/assets.js on lines 17..28

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

            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

                  find.exec(function(err, room) {
                    if (err) {
                      return reply(err);
                    }
            
            
            Severity: Minor
            Found in packages/colonizers/server/api/rooms.js and 1 other location - About 50 mins to fix
            packages/colonizers/server/api/sessions.js on lines 59..69

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

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

              server.route({
                method: 'GET',
                path: '/tilesets/{param*}',
                config: {
                  auth: false
            Severity: Major
            Found in packages/colonizers/server/assets.js and 3 other locations - About 50 mins to fix
            packages/colonizers/server/assets.js on lines 4..15
            packages/colonizers/server/assets.js on lines 43..54
            packages/colonizers/server/assets.js on lines 69..80

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

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

              server.route({
                method: 'GET',
                path: '/script/{param*}',
                config: {
                  auth: false
            Severity: Major
            Found in packages/colonizers/server/assets.js and 3 other locations - About 50 mins to fix
            packages/colonizers/server/assets.js on lines 4..15
            packages/colonizers/server/assets.js on lines 43..54
            packages/colonizers/server/assets.js on lines 56..67

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

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

              server.route({
                method: 'GET',
                path: '/bundles/{param*}',
                config: {
                  auth: false
            Severity: Major
            Found in packages/colonizers/server/assets.js and 3 other locations - About 50 mins to fix
            packages/colonizers/server/assets.js on lines 43..54
            packages/colonizers/server/assets.js on lines 56..67
            packages/colonizers/server/assets.js on lines 69..80

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

            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