concord-consortium/lara

View on GitHub
app/assets/javascripts/jquery.jcarousel.js

Summary

Maintainability
F
1 wk
Test Coverage

File jquery.jcarousel.js has 1118 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*! jCarousel - v0.3.1 - 2014-04-26
* http://sorgalla.com/jcarousel
* Copyright (c) 2014 Jan Sorgalla; Licensed MIT */
(function($) {
    'use strict';
Severity: Major
Found in app/assets/javascripts/jquery.jcarousel.js - About 2 days to fix

    Function scroll has 106 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            scroll: function(target, animate, callback) {
                if (this.animating) {
                    return this;
                }
    
    
    Severity: Major
    Found in app/assets/javascripts/jquery.jcarousel.js - About 4 hrs to fix

      Function _prepare has 98 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              _prepare: function(item) {
                  var index  = this.index(item),
                      idx    = index,
                      wh     = this.dimension(item),
                      clip   = this.clipping(),
      Severity: Major
      Found in app/assets/javascripts/jquery.jcarousel.js - About 3 hrs to fix

        Function base has 84 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            jCarousel.base = function(pluginName) {
                return {
                    version:  jCarousel.version,
                    _options:  {},
                    _element:  null,
        Severity: Major
        Found in app/assets/javascripts/jquery.jcarousel.js - About 3 hrs to fix

          Function _reload has 57 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  _reload: function() {
                      var perPage = this.options('perPage');
          
                      this._pages = {};
                      this._items = {};
          Severity: Major
          Found in app/assets/javascripts/jquery.jcarousel.js - About 2 hrs to fix

            Function move has 48 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    move: function(properties, opts) {
                        opts = opts || {};
            
                        var option       = this.options('transitions'),
                            transitions  = !!option,
            Severity: Minor
            Found in app/assets/javascripts/jquery.jcarousel.js - About 1 hr to fix

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

                  jCarousel.plugin = function(pluginName, pluginPrototype) {
                      var Plugin = $[pluginName] = function(element, options) {
                          this._element = $(element);
                          this.options(options);
              
              
              Severity: Minor
              Found in app/assets/javascripts/jquery.jcarousel.js - About 1 hr to fix

                Function scrollIntoView has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    $.jcarousel.fn.scrollIntoView = function(target, animate, callback) {
                        var parsed = $.jCarousel.parseTarget(target),
                            first  = this.index(this._fullyvisible.first()),
                            last   = this.index(this._fullyvisible.last()),
                            index;
                Severity: Minor
                Found in app/assets/javascripts/jquery.jcarousel.js - About 1 hr to fix

                  Consider simplifying this complex logical expression.
                  Open

                                          if ((this.underflow && current === end && (wrap === 'circular' || wrap === 'both' || wrap === 'last')) ||
                                              (!this.underflow && last === end && (wrap === 'both' || wrap === 'last'))) {
                                              this._scroll(0, animate, callback);
                                          } else {
                                              index = current + scroll;
                  Severity: Critical
                  Found in app/assets/javascripts/jquery.jcarousel.js - About 1 hr to fix

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

                            _reload: function() {
                                this.vertical = this.options('vertical');
                    
                                if (this.vertical == null) {
                                    this.vertical = this.list().height() > this.list().width();
                    Severity: Minor
                    Found in app/assets/javascripts/jquery.jcarousel.js - About 1 hr to fix

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

                              _update: function(update) {
                                  var self = this,
                                      current = {
                                          target:       this._target || $(),
                                          first:        this._first || $(),
                      Severity: Minor
                      Found in app/assets/javascripts/jquery.jcarousel.js - About 1 hr to fix

                        Function pluginName has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                $.fn[pluginName] = function(options) {
                                    var args        = Array.prototype.slice.call(arguments, 1),
                                        returnValue = this;
                        
                                    if (typeof options === 'string') {
                        Severity: Minor
                        Found in app/assets/javascripts/jquery.jcarousel.js - About 1 hr to fix

                          Function _animate has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  _animate: function(properties, animate, callback) {
                                      callback = callback || $.noop;
                          
                                      if (false === this._trigger('animate')) {
                                          callback.call(this, false);
                          Severity: Minor
                          Found in app/assets/javascripts/jquery.jcarousel.js - About 1 hr to fix

                            Function _scroll has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    _scroll: function(item, animate, callback) {
                                        if (this.animating) {
                                            if ($.isFunction(callback)) {
                                                callback.call(this, false);
                                            }
                            Severity: Minor
                            Found in app/assets/javascripts/jquery.jcarousel.js - About 1 hr to fix

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

                                      closest: function() {
                                          var self    = this,
                                              pos     = this.list().position()[this.lt],
                                              closest = $(), // Ensure we're returning a jQuery instance
                                              stop    = false,
                              Severity: Minor
                              Found in app/assets/javascripts/jquery.jcarousel.js - About 1 hr to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                            if (wrap === 'both' || wrap === 'last') {
                                                                this._scroll(0, animate, callback);
                                                            } else {
                                                                if ($.isFunction(callback)) {
                                                                    callback.call(this, false);
                                Severity: Major
                                Found in app/assets/javascripts/jquery.jcarousel.js - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                              if (this.circular && index < 0) {
                                                                  i    = index;
                                                                  curr = this.items().get(0);
                                  
                                                                  while (i++ < 0) {
                                  Severity: Major
                                  Found in app/assets/javascripts/jquery.jcarousel.js - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                                if (this.circular && index > end) {
                                                                    i = end;
                                                                    curr = this.items().get(-1);
                                    
                                                                    while (i++ < index) {
                                    Severity: Major
                                    Found in app/assets/javascripts/jquery.jcarousel.js - About 45 mins to fix

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

                                      (function($) {
                                          'use strict';
                                      
                                          $.jCarousel.plugin('jcarouselControl', {
                                              _options: {
                                      Severity: Major
                                      Found in app/assets/javascripts/jquery.jcarousel.js and 1 other location - About 3 days to fix
                                      app/assets/javascripts/jquery.jcarousel-control.js on lines 4..76

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

                                      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

                                                  if (this.rtl && this.relative && !this.vertical) {
                                                      pos += this.list().width() - this.clipping();
                                                  }
                                      Severity: Major
                                      Found in app/assets/javascripts/jquery.jcarousel.js and 1 other location - About 1 hr to fix
                                      app/assets/javascripts/jquery.jcarousel.js on lines 738..740

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

                                                  if (this.rtl && this.relative && !this.vertical) {
                                                      pos += this.list().width() - this.clipping();
                                                  }
                                      Severity: Major
                                      Found in app/assets/javascripts/jquery.jcarousel.js and 1 other location - About 1 hr to fix
                                      app/assets/javascripts/jquery.jcarousel.js on lines 387..389

                                      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

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

                                                          current[key].each(function() {
                                                              if (update[key].index(this) < 0) {
                                                                  elOut.push(this);
                                                              }
                                                          });
                                      Severity: Minor
                                      Found in app/assets/javascripts/jquery.jcarousel.js and 1 other location - About 55 mins to fix
                                      app/assets/javascripts/jquery.jcarousel.js on lines 990..994

                                      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

                                                          update[key].each(function() {
                                                              if (current[key].index(this) < 0) {
                                                                  elIn.push(this);
                                                              }
                                                          });
                                      Severity: Minor
                                      Found in app/assets/javascripts/jquery.jcarousel.js and 1 other location - About 55 mins to fix
                                      app/assets/javascripts/jquery.jcarousel.js on lines 996..1000

                                      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

                                                  if (properties.left) {
                                                      properties.left = (position.left + correction + toFloat(properties.left) * multiplier) + 'px';
                                                  }
                                      Severity: Minor
                                      Found in app/assets/javascripts/jquery.jcarousel.js and 1 other location - About 45 mins to fix
                                      app/assets/javascripts/jquery.jcarousel.js on lines 614..616

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

                                      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 (properties.top) {
                                                      properties.top = (position.top + correction + toFloat(properties.top) * multiplier) + 'px';
                                                  }
                                      Severity: Minor
                                      Found in app/assets/javascripts/jquery.jcarousel.js and 1 other location - About 45 mins to fix
                                      app/assets/javascripts/jquery.jcarousel.js on lines 610..612

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

                                      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.carousel()
                                                      .one('jcarousel:destroy', this.onDestroy)
                                                      .on('jcarousel:reloadend', this.onReload)
                                                      .on('jcarousel:scrollend', this.onScroll);
                                      Severity: Minor
                                      Found in app/assets/javascripts/jquery.jcarousel.js and 1 other location - About 40 mins to fix
                                      app/assets/javascripts/jquery.jcarousel.js on lines 1194..1197

                                      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

                                                  this.carousel()
                                                      .off('jcarousel:destroy', this.onDestroy)
                                                      .off('jcarousel:reloadend', this.onReload)
                                                      .off('jcarousel:scrollend', this.onScroll);
                                      Severity: Minor
                                      Found in app/assets/javascripts/jquery.jcarousel.js and 1 other location - About 40 mins to fix
                                      app/assets/javascripts/jquery.jcarousel.js on lines 1184..1187

                                      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

                                                  if (transforms3d) {
                                                      css.transform = 'translate3d(' + (properties.left || 0) + ',' + (properties.top || 0) + ',0)';
                                                  } else if (transforms) {
                                                      css.transform = 'translate(' + (properties.left || 0) + ',' + (properties.top || 0) + ')';
                                                  } else {
                                      Severity: Minor
                                      Found in app/assets/javascripts/jquery.jcarousel.js and 1 other location - About 35 mins to fix
                                      app/assets/javascripts/jquery.jcarousel.js on lines 664..668

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

                                      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 (transforms) {
                                                      css.transform = 'translate(' + (properties.left || 0) + ',' + (properties.top || 0) + ')';
                                                  } else {
                                                      $.extend(css, properties);
                                                  }
                                      Severity: Minor
                                      Found in app/assets/javascripts/jquery.jcarousel.js and 1 other location - About 35 mins to fix
                                      app/assets/javascripts/jquery.jcarousel.js on lines 662..668

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

                                      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