ocadotechnology/rapid-router

View on GitHub
game/static/game/js/foundation/foundation/foundation.clearing.js

Summary

Maintainability
D
2 days
Test Coverage

File foundation.clearing.js has 462 lines of code (exceeds 250 allowed). Consider refactoring.
Open

;(function ($, window, document, undefined) {
  'use strict';

  Foundation.libs.clearing = {
    name : 'clearing',
Severity: Minor
Found in game/static/game/js/foundation/foundation/foundation.clearing.js - About 7 hrs to fix

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

        open : function ($image, current, target) {
          var self = this,
              body = $(document.body),
              root = target.closest('.clearing-assembled'),
              container = self.S('div', root).first(),
    Severity: Major
    Found in game/static/game/js/foundation/foundation/foundation.clearing.js - About 2 hrs to fix

      Function swipe_events has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          swipe_events : function (scope) {
            var self = this,
            S = self.S;
      
            S(this.scope)
      Severity: Minor
      Found in game/static/game/js/foundation/foundation/foundation.clearing.js - About 1 hr to fix

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

            events : function (scope) {
              var self = this,
                  S = self.S,
                  $scroll_container = $('.scroll-container');
        
        
        Severity: Minor
        Found in game/static/game/js/foundation/foundation/foundation.clearing.js - About 1 hr to fix

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

              shift : function (current, target, callback) {
                var clearing = target.parent(),
                    old_index = this.settings.prev_index || target.index(),
                    direction = this.direction(clearing, current, target),
                    dir = this.rtl ? 'right' : 'left',
          Severity: Minor
          Found in game/static/game/js/foundation/foundation/foundation.clearing.js - About 1 hr to fix

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

                      if (typeof data.is_scrolling === 'undefined') {
                        data.is_scrolling = !!( data.is_scrolling || Math.abs(data.delta_x) < Math.abs(e.touches[0].pageY - data.start_page_y) );
                      }
            game/static/game/js/foundation/foundation/foundation.orbit.js on lines 269..271

            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 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,
            game/static/game/js/foundation/foundation/foundation.orbit.js on lines 245..251

            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

                  if (target.next().length > 0) {
                    this.S('.clearing-main-next', visible_image).removeClass('disabled');
                  } else {
                    this.S('.clearing-main-next', visible_image).addClass('disabled');
                  }
            game/static/game/js/foundation/foundation/foundation.clearing.js on lines 369..373

            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 (target.prev().length > 0) {
                    this.S('.clearing-main-prev', visible_image).removeClass('disabled');
                  } else {
                    this.S('.clearing-main-prev', visible_image).addClass('disabled');
                  }
            game/static/game/js/foundation/foundation/foundation.clearing.js on lines 363..367

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

                off : function () {
                  this.S(this.scope).off('.fndtn.clearing');
                  this.S(window).off('.fndtn.clearing');
                },
            game/static/game/js/foundation/foundation/foundation.magellan.js on lines 196..199
            game/static/game/js/foundation/foundation/foundation.topbar.js on lines 451..454

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

                    if (/left/.test(direction)) {
                      this.lock();
                      dir_obj[dir] = left + width;
                      clearing.animate(dir_obj, 300, this.unlock());
                    } else if (/right/.test(direction)) {
            game/static/game/js/foundation/foundation/foundation.clearing.js on lines 504..508

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

            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 if (/right/.test(direction)) {
                      this.lock();
                      dir_obj[dir] = left - width;
                      clearing.animate(dir_obj, 300, this.unlock());
                    }
            game/static/game/js/foundation/foundation/foundation.clearing.js on lines 500..508

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

            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

            There are no issues that match your filters.

            Category
            Status