dynamic/foxystripe

View on GitHub

Showing 127 of 127 total issues

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

;(function ($) {
    var field = $("input[name='x:visibleQuantity']"),
        quantityField = $("input[name='quantity']"),
        getLink = function (element) {
            return element.parent().find("input[name='x:visibleQuantity']").data('link');
Severity: Major
Found in client/src/javascript/quantity.js and 1 other location - About 1 wk to fix
javascript/quantity.js on lines 1..134

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

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 ($) {
    var field = $("input[name='x:visibleQuantity']"),
        quantityField = $("input[name='quantity']"),
        getLink = function (element) {
            return element.parent().find("input[name='x:visibleQuantity']").data('link');
Severity: Major
Found in javascript/quantity.js and 1 other location - About 1 wk to fix
client/src/javascript/quantity.js on lines 1..134

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

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

  $.flexslider = function(el, options) {
    var slider = $(el);

    // making variables public
    slider.vars = $.extend({}, $.flexslider.defaults, options);
Severity: Major
Found in thirdparty/flexslider/jquery.flexslider.js - About 4 days to fix

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

/*
 * jQuery FlexSlider v2.2.2
 * Copyright 2012 WooThemes
 * Contributing Author: Tyler Smith
 */
Severity: Major
Found in thirdparty/flexslider/jquery.flexslider.js - About 2 days to fix

Function fc_hash_html has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
Open

    public static function fc_hash_html($html)
    {
        // Initialize some counting
        $count['temp'] = 0; // temp counter
        $count['links'] = 0;
Severity: Minor
Found in src/Model/foxycart.cart_validation.php - About 1 day 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

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

                if (slider.animatingTo === slider.currentSlide && !scrolling && !(dx === null)) {
                    var updateDx = (reverse) ? -dx : dx,
                        target = (updateDx > 0) ? slider.getTarget('next') : slider.getTarget('prev');

                    if (slider.canAdvance(target) && (Number(new Date()) - startT < 550 && Math.abs(updateDx) > 50 || Math.abs(updateDx) > cwidth/2)) {
Severity: Major
Found in thirdparty/flexslider/jquery.flexslider.js and 1 other location - About 1 day to fix
thirdparty/flexslider/jquery.flexslider.js on lines 452..461

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

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 (slider.animatingTo === slider.currentSlide && !scrolling && !(dx === null)) {
                var updateDx = (reverse) ? -dx : dx,
                    target = (updateDx > 0) ? slider.getTarget('next') : slider.getTarget('prev');

                if (slider.canAdvance(target) && (Number(new Date()) - startT < 550 && Math.abs(updateDx) > 50 || Math.abs(updateDx) > cwidth/2)) {
Severity: Major
Found in thirdparty/flexslider/jquery.flexslider.js and 1 other location - About 1 day to fix
thirdparty/flexslider/jquery.flexslider.js on lines 537..546

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

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

    public static function fc_hash_html($html)
    {
        // Initialize some counting
        $count['temp'] = 0; // temp counter
        $count['links'] = 0;
Severity: Major
Found in src/Model/foxycart.cart_validation.php - About 1 day to fix

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

                offset = (carousel && reverse && slider.animatingTo === slider.last) ? 0 :
                         (carousel && reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo) :
                         (carousel && slider.currentSlide === slider.last) ? slider.limit :
                         (carousel) ? ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.currentSlide :
                         (reverse) ? (slider.last - slider.currentSlide + slider.cloneOffset) * cwidth : (slider.currentSlide + slider.cloneOffset) * cwidth;
Severity: Major
Found in thirdparty/flexslider/jquery.flexslider.js and 1 other location - About 7 hrs to fix
thirdparty/flexslider/jquery.flexslider.js on lines 490..494

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

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

                    offset = (carousel && reverse && slider.animatingTo === slider.last) ? 0 :
                        (carousel && reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo) :
                            (carousel && slider.currentSlide === slider.last) ? slider.limit :
                                (carousel) ? ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.currentSlide :
                                    (reverse) ? (slider.last - slider.currentSlide + slider.cloneOffset) * cwidth : (slider.currentSlide + slider.cloneOffset) * cwidth;
Severity: Major
Found in thirdparty/flexslider/jquery.flexslider.js and 1 other location - About 7 hrs to fix
thirdparty/flexslider/jquery.flexslider.js on lines 413..417

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

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

    public function getCMSFields()
    {
        $fields = FieldList::create(
            TabSet::create(
                'Root',
Severity: Major
Found in src/Model/FoxyStripeSetting.php - About 7 hrs to fix

File FoxyStripeSetting.php has 415 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Dynamic\FoxyStripe\Model;

use Dynamic\CountryDropdownField\Fields\CountryDropdownField;
Severity: Minor
Found in src/Model/FoxyStripeSetting.php - About 5 hrs to fix

Function touch has 139 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      touch: function() {
        var startX,
          startY,
          offset,
          cwidth,
Severity: Major
Found in thirdparty/flexslider/jquery.flexslider.js - About 5 hrs to fix

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

              if ( ! scrolling || Number( new Date() ) - startT > fxms ) {
                e.preventDefault();
                if (!fade && slider.transitions) {
                  if (!slider.vars.animationLoop) {
                    dx = dx/((slider.currentSlide === 0 && dx < 0 || slider.currentSlide === slider.last && dx > 0) ? (Math.abs(dx)/cwidth+2) : 1);
Severity: Major
Found in thirdparty/flexslider/jquery.flexslider.js and 1 other location - About 5 hrs to fix
thirdparty/flexslider/jquery.flexslider.js on lines 520..528

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

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 (!scrolling || Number(new Date()) - startT > 500) {
                    e.preventDefault();
                    if (!fade && slider.transitions) {
                        if (!slider.vars.animationLoop) {
                            dx = accDx / ((slider.currentSlide === 0 && accDx < 0 || slider.currentSlide === slider.last && accDx > 0) ? (Math.abs(accDx) / cwidth + 2) : 1);
Severity: Major
Found in thirdparty/flexslider/jquery.flexslider.js and 1 other location - About 5 hrs to fix
thirdparty/flexslider/jquery.flexslider.js on lines 437..445

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

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

    public function getCMSFields()
    {
        $fields = parent::getCMSFields();

        $fields->removeByName([
Severity: Major
Found in src/Model/OptionItem.php - About 4 hrs to fix

File ProductPage.php has 337 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Dynamic\FoxyStripe\Page;

use Bummzack\SortableFile\Forms\SortableUploadField;
Severity: Minor
Found in src/Page/ProductPage.php - About 4 hrs to fix

`` has 31 functions (exceeds 20 allowed). Consider refactoring.
Open

{
    def: 'easeOutQuad',
    swing: function (x, t, b, c, d) {
        //alert(jQuery.easing.default);
        return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
Severity: Minor
Found in thirdparty/flexslider/demo/js/jquery.easing.js - About 3 hrs to fix

File foxycart.cart_validation.php has 326 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

use Dynamic\FoxyStripe\Model\FoxyCart;

/**
Severity: Minor
Found in src/Model/foxycart.cart_validation.php - About 3 hrs to fix

Method getCMSFields has 95 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getCMSFields()
    {
        $this->beforeUpdateCMSFields(function (FieldList $fields) {
            // Cateogry Dropdown field w/ add new
            $source = function () {
Severity: Major
Found in src/Page/ProductPage.php - About 3 hrs to fix
Severity
Category
Status
Source
Language