jasonrobertfox/tictactoe

View on GitHub

Showing 126 of 126 total issues

Function _goto has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    self._goto = function(next_idx, start_timer) {
      // if (locked) {return false;}
      if (next_idx === idx) {return false;}
      if (typeof timer === 'object') {timer.restart();}
      var slides = slides_container.children();
Severity: Minor
Found in lib/assets/javascripts/foundation/foundation.orbit.js - About 1 hr to fix

    Function init has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        init : function (section, method, options) {
          Foundation.inherit(this, 'data_options addCustomRule');
          var self = this;
    
          if (typeof method === 'object') {
    Severity: Minor
    Found in lib/assets/javascripts/foundation/foundation.topbar.js - About 1 hr to fix

      Function open has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          open : function (target, ajax_settings) {
            if (target) {
              if (typeof target.selector !== 'undefined') {
                var modal = $('#' + target.data('reveal-id'));
              } else {
      Severity: Minor
      Found in lib/assets/javascripts/foundation/foundation.reveal.js - About 1 hr to fix

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

                  var data = {
                        start_page_x: e.touches[0].pageX,
                        start_page_y: e.touches[0].pageY,
                        start_time: (new Date()).getTime(),
                        delta_x: 0,
        Severity: Major
        Found in lib/assets/javascripts/foundation/foundation.clearing.js and 1 other location - About 1 hr to fix
        lib/assets/javascripts/foundation/foundation.orbit.js on lines 217..223

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

        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

                  var data = {
                    start_page_x: e.touches[0].pageX,
                    start_page_y: e.touches[0].pageY,
                    start_time: (new Date()).getTime(),
                    delta_x: 0,
        Severity: Major
        Found in lib/assets/javascripts/foundation/foundation.orbit.js and 1 other location - About 1 hr to fix
        lib/assets/javascripts/foundation/foundation.clearing.js on lines 116..122

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

        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

        Method minmax has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

              def minmax(game_state, depth, lower_bound, upper_bound)
                return evaluate_state(game_state, depth) if game_state.over?
                candidate_move_nodes = []
                game_state.available_moves.each do |move|
                  child_board = game_state.make_move(move)
        Severity: Minor
        Found in lib/tictactoe/player/perfect_player.rb - About 1 hr to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

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

            init : function (scope, method, options) {
              Foundation.inherit(this, 'data_options');
              var self = this;
        
              if (typeof method === 'object') {
        Severity: Minor
        Found in lib/assets/javascripts/foundation/foundation.tooltips.js - About 1 hr to fix

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

              reposition : function (target, tip, classes) {
                var width, nub, nubHeight, nubWidth, column, objPos;
          
                tip.css('visibility', 'hidden').show();
          
          
          Severity: Minor
          Found in lib/assets/javascripts/foundation/foundation.tooltips.js - About 1 hr to fix

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

                    if (this.top()) {
            
                        this.settings.$next_tip.offset({top: this.settings.$target.offset().top - tip_height - nub_height});
                        $nub.addClass('bottom');
            
            
            Severity: Major
            Found in lib/assets/javascripts/foundation/foundation.joyride.js and 1 other location - About 1 hr to fix
            lib/assets/javascripts/foundation/foundation.joyride.js on lines 533..538

            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

                    } else {
            
                      this.settings.$next_tip.offset({top: this.settings.$target.offset().top + target_height + nub_height});
                      $nub.addClass('top');
            
            
            Severity: Major
            Found in lib/assets/javascripts/foundation/foundation.joyride.js and 1 other location - About 1 hr to fix
            lib/assets/javascripts/foundation/foundation.joyride.js on lines 528..533

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

                events : function () {
                  var self = this;
            
                  $(this.scope)
                    .on('click.joyride', '.joyride-next-tip, .joyride-modal-bg', function (e) {
            Severity: Minor
            Found in lib/assets/javascripts/foundation/foundation.joyride.js - About 1 hr to fix

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

                    if (target.prev().length > 0) {
                      visible_image
                        .find('.clearing-main-prev')
                        .removeClass('disabled');
                    } else {
              Severity: Major
              Found in lib/assets/javascripts/foundation/foundation.clearing.js and 1 other location - About 1 hr to fix
              lib/assets/javascripts/foundation/foundation.clearing.js on lines 281..289

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

              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 (target.next().length > 0) {
                      visible_image
                        .find('.clearing-main-next')
                        .removeClass('disabled');
                    } else {
              Severity: Major
              Found in lib/assets/javascripts/foundation/foundation.clearing.js and 1 other location - About 1 hr to fix
              lib/assets/javascripts/foundation/foundation.clearing.js on lines 291..299

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

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

                  swipe_events : function () {
                    var self = this;
              
                    $(this.scope)
                      .on('touchstart.fndtn.clearing', '.visible-img', function(e) {
              Severity: Minor
              Found in lib/assets/javascripts/foundation/foundation.clearing.js - About 1 hr to fix

                Function start has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    start : function () {
                      var self = this,
                          $this = $(this.scope).find('[data-joyride]'),
                          integer_settings = ['timer', 'scrollSpeed', 'startOffset', 'tipAnimationFadeSpeed', 'cookieExpires'],
                          int_settings_count = integer_settings.length;
                Severity: Minor
                Found in lib/assets/javascripts/foundation/foundation.joyride.js - About 1 hr to fix

                  Method check_line has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def check_line(candidate_space, line_id)
                        return if @imposible_lines.include?(line_id)
                        candidate = @board.contents_of(candidate_space)
                        return unless candidate
                        line = [candidate_space]
                  Severity: Minor
                  Found in lib/tictactoe/game_state.rb - About 1 hr to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Function events has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      events : function () {
                        var self = this;
                  
                        $(this.scope)
                          .on('click.fndtn.dropdown', '[data-dropdown]', function (e) {
                  Severity: Minor
                  Found in lib/assets/javascripts/foundation/foundation.dropdown.js - About 1 hr to fix

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

                          if (typeof method === 'object') {
                            $.extend(true, this.settings, method);
                          } else if (typeof options !== 'undefined') {
                            $.extend(true, this.settings, options);
                          }
                    Severity: Major
                    Found in lib/assets/javascripts/foundation/foundation.tooltips.js and 2 other locations - About 1 hr to fix
                    lib/assets/javascripts/foundation/foundation.reveal.js on lines 42..46
                    lib/assets/javascripts/foundation/foundation.topbar.js on lines 26..30

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

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

                          if (typeof method === 'object') {
                            $.extend(true, this.settings, method);
                          } else if (typeof options !== 'undefined') {
                            $.extend(true, this.settings, options);
                          }
                    Severity: Major
                    Found in lib/assets/javascripts/foundation/foundation.topbar.js and 2 other locations - About 1 hr to fix
                    lib/assets/javascripts/foundation/foundation.reveal.js on lines 42..46
                    lib/assets/javascripts/foundation/foundation.tooltips.js on lines 31..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 61.

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

                          if (typeof method === 'object') {
                            $.extend(true, this.settings, method);
                          } else if (typeof options !== 'undefined') {
                            $.extend(true, this.settings, options);
                          }
                    Severity: Major
                    Found in lib/assets/javascripts/foundation/foundation.reveal.js and 2 other locations - About 1 hr to fix
                    lib/assets/javascripts/foundation/foundation.tooltips.js on lines 31..35
                    lib/assets/javascripts/foundation/foundation.topbar.js on lines 26..30

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

                    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