lpaulger/cribbage-the-game

View on GitHub

Showing 37 of 37 total issues

Function exports has 398 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(grunt) {
  // show elapsed time at the end
  require('time-grunt')(grunt);
  // load all grunt tasks
  require('load-grunt-tasks')(grunt);
Severity: Major
Found in Gruntfile.js - About 1 day to fix

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

        if(!isNaN(player.selectedScore)){
          pointDifference = player.selectedScore - points;//positive, negative 0
          if(pointDifference > 0){
            this.mediator.publish('messages-add', player.name + ' said ' + player.selectedScore + ' points');
            this.mediator.publish('messages-add', 'the actual points were ' + points);
    Severity: Major
    Found in app/scripts/modules/PlayScoreKeeper.js and 1 other location - About 1 day to fix
    app/scripts/modules/CountScoreKeeper.js on lines 165..177

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

    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(!isNaN(player.selectedScore)){
          pointDifference = player.selectedScore - gainedPoints;//positive, negative 0
          if(pointDifference > 0){
            this.mediator.publish('messages-add', player.name + ' said ' + player.selectedScore + ' points');
            this.mediator.publish('messages-add', 'the actual points were ' + gainedPoints);
    Severity: Major
    Found in app/scripts/modules/CountScoreKeeper.js and 1 other location - About 1 day to fix
    app/scripts/modules/PlayScoreKeeper.js on lines 142..154

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

    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 Gruntfile.js has 408 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // Generated on 2014-04-25 using generator-mobile 1.0.0-alpha.1
    /* jshint ignore:start */
    'use strict';
    var LIVERELOAD_PORT = 35729;
    var lrSnippet = require('connect-livereload')({
    Severity: Minor
    Found in Gruntfile.js - About 5 hrs to fix

      Function getRuns has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        CountScoreKeeper.prototype.getRuns = function(hand, starter){
          var points = 0;
      
          var cards = hand.concat(starter);
      
      
      Severity: Major
      Found in app/scripts/modules/CountScoreKeeper.js - About 2 hrs to fix

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

            isOneSelected: function(hand, index){
              var selectedCards = hand.filter(function(card){
                return card.selected === 'selected';
              });
        
        
        Severity: Major
        Found in app/scripts/modules/PlayerModule.js and 1 other location - About 1 hr to fix
        app/scripts/modules/PlayerModule.js on lines 158..164

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

        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

            areTwoCardsSelected: function(hand, index){
              var selectedCards = hand.filter(function(card){
                return card.selected === 'selected';
              });
        
        
        Severity: Major
        Found in app/scripts/modules/PlayerModule.js and 1 other location - About 1 hr to fix
        app/scripts/modules/PlayerModule.js on lines 151..157

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

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

            function Game(options){
              this.$deck = new Deck(options.$deck);
        
              var boardSettings = {scoreKeeper:new ScoreKeeper()};
              for(var attrname in options.$board){
        Severity: Minor
        Found in app/scripts/modules/GameModule.js - About 1 hr to fix

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

                if(options.$cribOwner){
                  this.$cribOwner = [this.$player1, this.$player2].filter(function(player){
                    return player.name === options.$cribOwner;
                  })[0];
                }
          Severity: Major
          Found in app/scripts/modules/GameModule.js and 1 other location - About 1 hr to fix
          app/scripts/modules/GameModule.js on lines 41..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 66.

          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(options.currentPlayer){
                  this.currentPlayer = [this.$player1, this.$player2].filter(function(player){
                    return player.name === options.currentPlayer;
                  })[0];
                }
          Severity: Major
          Found in app/scripts/modules/GameModule.js and 1 other location - About 1 hr to fix
          app/scripts/modules/GameModule.js on lines 35..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 66.

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

            BaseState.prototype.bindEvents = function(){
              $('#deck').on('click', function(e){
                this.unbindEvents();
                var cardIndex = $('#deck ul').children().indexOf(e.target.parentNode);
                $(e.target).addClass('selected');
          Severity: Minor
          Found in app/scripts/gameStates/BaseState.js - About 1 hr to fix

            Function evaluatePlay has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              PlayScoreKeeper.prototype.evaluatePlay = function(player, playCards, totalPlayedCards){
                var points = 0;
                var pointDifference = 0;
                var additionalMessage = '';
            
            
            Severity: Minor
            Found in app/scripts/modules/PlayScoreKeeper.js - About 1 hr to fix

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

                  function isSequential(card, i, arr){
                    if(i === arr.length - 1)//isLastCard
                      return true;
                    return card.faceValue + 1 === arr[i + 1].faceValue;
                  }
              Severity: Major
              Found in app/scripts/modules/CountScoreKeeper.js and 1 other location - About 1 hr to fix
              app/scripts/modules/PlayScoreKeeper.js on lines 53..59

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

              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

                  function checkSequence(ele, index, array){
              
                    if(index === array.length - 1)//isLastCard
                      return true;
              
              
              Severity: Major
              Found in app/scripts/modules/PlayScoreKeeper.js and 1 other location - About 1 hr to fix
              app/scripts/modules/CountScoreKeeper.js on lines 98..102

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

              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

                CountState.prototype.bindEvents = function(){
                  //bind defaults
                  BaseState.prototype.bindEvents.call(this);
              
                  scoreControlComp.init(this.p1);
              Severity: Major
              Found in app/scripts/gameStates/CountState.js and 1 other location - About 1 hr to fix
              app/scripts/gameStates/PlayState.js on lines 98..103

              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

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

                PlayState.prototype.bindEvents = function(){
                  //bind defaults
                  BaseState.prototype.bindEvents.call(this);
              
                  scoreControlComp.init(this.p1);
              Severity: Major
              Found in app/scripts/gameStates/PlayState.js and 1 other location - About 1 hr to fix
              app/scripts/gameStates/CountState.js on lines 53..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 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 combinationUtil has 8 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                function combinationUtil(inputArray, sizeOfInputArray, sizeOfCombination, index, tempArray, indexOfCurrentElementOfInputArray, matchesArr, matchCondition)
              Severity: Major
              Found in app/scripts/modules/CountScoreKeeper.js - About 1 hr to fix

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

                  function setAvailablePoints(size){
                    var i = 0;
                    var arrayPoints = [];
                    while(i < size){
                      i++;
                Severity: Minor
                Found in app/scripts/gameStates/CountState.js and 1 other location - About 55 mins to fix
                app/scripts/gameStates/PlayState.js on lines 105..113

                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

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

                  function setAvailablePoints(size){
                    var i = 0;
                    var arrayPoints = [];
                    while(i < size){
                      i++;
                Severity: Minor
                Found in app/scripts/gameStates/PlayState.js and 1 other location - About 55 mins to fix
                app/scripts/gameStates/CountState.js on lines 60..68

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

                    $(document).off('backbutton').on('backbutton', function(){
                      this.mediator.publish('transition', 'Back');
                    }.bind(this));
                Severity: Major
                Found in app/scripts/gameStates/InfoState.js and 2 other locations - About 55 mins to fix
                app/scripts/gameStates/BaseState.js on lines 131..133
                app/scripts/gameStates/HomeState.js on lines 32..34

                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

                Severity
                Category
                Status
                Source
                Language