pasalino/TinyLanding

View on GitHub
app/templates/scripts/parallax.js

Summary

Maintainability
D
2 days
Test Coverage

Function Parallax has 94 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function Parallax(element, options) {
    var self = this;

    if (typeof options == 'object') {
      delete options.refresh;
Severity: Major
Found in app/templates/scripts/parallax.js - About 3 hrs to fix

    File parallax.js has 323 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*!
     * parallax.js v1.5.0 (http://pixelcog.github.io/parallax.js/)
     * @copyright 2016 PixelCog, Inc.
     * @license MIT (https://github.com/pixelcog/parallax.js/blob/master/LICENSE)
     */
    Severity: Minor
    Found in app/templates/scripts/parallax.js - About 3 hrs to fix

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

          refresh: function() {
            this.boxWidth        = this.$element.outerWidth();
            this.boxHeight       = this.$element.outerHeight() + this.bleed * 2;
            this.boxOffsetTop    = this.$element.offset().top - this.bleed;
            this.boxOffsetLeft   = this.$element.offset().left;
      Severity: Minor
      Found in app/templates/scripts/parallax.js - About 1 hr to fix

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

            setup: function() {
              if (this.isReady) return;
        
              var self = this;
        
        
        Severity: Minor
        Found in app/templates/scripts/parallax.js - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

                if (!self.naturalHeight || !self.naturalWidth) {
                  self.naturalHeight = this.naturalHeight || this.height || 1;
                  self.naturalWidth  = this.naturalWidth  || this.width  || 1;
                }
          Severity: Major
          Found in app/templates/scripts/parallax.js - About 40 mins to fix

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

                if (navigator.userAgent.match(/(Android)/)) {
                  if (this.imageSrc && this.androidFix && !this.$element.is('img')) {
                    this.$element.css({
                      backgroundImage: 'url(' + this.imageSrc + ')',
                      backgroundSize: 'cover',
            Severity: Major
            Found in app/templates/scripts/parallax.js and 1 other location - About 3 hrs to fix
            app/templates/scripts/parallax.js on lines 93..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 106.

            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 (navigator.userAgent.match(/(iPod|iPhone|iPad)/)) {
                  if (this.imageSrc && this.iosFix && !this.$element.is('img')) {
                    this.$element.css({
                      backgroundImage: 'url(' + this.imageSrc + ')',
                      backgroundSize: 'cover',
            Severity: Major
            Found in app/templates/scripts/parallax.js and 1 other location - About 3 hrs to fix
            app/templates/scripts/parallax.js on lines 104..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 106.

            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 (this.positionY != 'top' && this.positionY != 'bottom') {
                  if (isNaN(parseInt(this.positionY))) {
                    this.positionY = 'center';
                  } else {
                    this.positionY = parseInt(this.positionY);
            Severity: Major
            Found in app/templates/scripts/parallax.js and 1 other location - About 2 hrs to fix
            app/templates/scripts/parallax.js on lines 73..79

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

            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 (this.positionX != 'left' && this.positionX != 'right') {
                  if (isNaN(parseInt(this.positionX))) {
                    this.positionX = 'center';
                  } else {
                    this.positionX = parseInt(this.positionX);
            Severity: Major
            Found in app/templates/scripts/parallax.js and 1 other location - About 2 hrs to fix
            app/templates/scripts/parallax.js on lines 81..87

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

            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