dynamic/foxystripe

View on GitHub

Showing 127 of 127 total issues

Method getProductFields has 88 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function getProductFields(FieldList $fields)
    {
        //Requirements::javascript('dynamic/foxystripe: client/dist/javascript/scripts.min.js');
        $hiddenTitle = ($this->product->ReceiptTitle) ?
            htmlspecialchars($this->product->ReceiptTitle) :
Severity: Major
Found in src/Form/FoxyStripePurchaseForm.php - About 3 hrs to fix

Function setCurrentStore has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    public function setCurrentStore()
    {
        $client = $this->getClient();
        $config = FoxyStripeSetting::current_foxystripe_setting();

Severity: Minor
Found in src/Model/FoxyStripeClient.php - About 3 hrs 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 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      init: function() {
        slider.animating = false;
        // Get current slide and make sure it is a number
        slider.currentSlide = parseInt( ( slider.vars.startAt ? slider.vars.startAt : 0), 10 );
        if ( isNaN( slider.currentSlide ) ) slider.currentSlide = 0;
Severity: Major
Found in thirdparty/flexslider/jquery.flexslider.js - About 3 hrs to fix

Function flexAnimate has 75 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    slider.flexAnimate = function(target, pause, override, withSync, fromNav) {
      if (!slider.vars.animationLoop && target !== slider.currentSlide) {
        slider.direction = (target > slider.currentSlide) ? "next" : "prev";
      }

Severity: Major
Found in thirdparty/flexslider/jquery.flexslider.js - About 3 hrs to fix

Function parseOrderDetails has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    public function parseOrderDetails($response)
    {

        // remove previous OrderDetails and OrderOptions so we don't end up with duplicates
        foreach ($this->Details() as $detail) {
Severity: Minor
Found in src/Model/Order.php - About 2 hrs 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

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

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

        if ($this->ID) {
Severity: Major
Found in src/Model/ProductCategory.php - About 2 hrs to fix

File OptionItem.php has 266 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Dynamic\FoxyStripe\Model;

use Dynamic\FoxyStripe\Page\ProductPage;
Severity: Minor
Found in src/Model/OptionItem.php - About 2 hrs to fix

Function getProductFields has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getProductFields(FieldList $fields)
    {
        //Requirements::javascript('dynamic/foxystripe: client/dist/javascript/scripts.min.js');
        $hiddenTitle = ($this->product->ReceiptTitle) ?
            htmlspecialchars($this->product->ReceiptTitle) :
Severity: Minor
Found in src/Form/FoxyStripePurchaseForm.php - About 2 hrs 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

Method fc_hash_querystring has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function fc_hash_querystring($qs, $output = true)
    {
        self::$log[] = '<strong>Signing link</strong> with data: '
            .htmlspecialchars(substr($qs, 0, 150)).'...';
        $fail = self::$cart_url.'?'.$qs;
Severity: Major
Found in src/Model/foxycart.cart_validation.php - About 2 hrs to fix

Function Brush has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function Brush()
    {
        function getKeywordsCSS(str)
        {
            return '\\b([a-z_]|)' + str.replace(/ /g, '(?=:)\\b|\\b([a-z_\\*]|\\*|)') + '(?=:)\\b';
Severity: Major
Found in thirdparty/flexslider/demo/js/shBrushCss.js - About 2 hrs to fix

Method getEditForm has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getEditForm($id = null, $fields = null)
    {
        $config = FoxyStripeSetting::current_foxystripe_setting();
        $fields = $config->getCMSFields();

Severity: Major
Found in src/Admin/FoxyStripeAdmin.php - About 2 hrs to fix

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

    slider.setup = function(type) {
      // SLIDE:
      if (!fade) {
        var sliderOffset, arr;

Severity: Major
Found in thirdparty/flexslider/jquery.flexslider.js - About 2 hrs to fix

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

        if (a < Math.abs(c)) { a=c; var s=p/4; }
        else var s = p/(2*Math.PI) * Math.asin (c/a);
Severity: Major
Found in thirdparty/flexslider/demo/js/jquery.easing.js and 2 other locations - About 1 hr to fix
thirdparty/flexslider/demo/js/jquery.easing.js on lines 122..123
thirdparty/flexslider/demo/js/jquery.easing.js on lines 136..137

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

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

        if (a < Math.abs(c)) { a=c; var s=p/4; }
        else var s = p/(2*Math.PI) * Math.asin (c/a);
Severity: Major
Found in thirdparty/flexslider/demo/js/jquery.easing.js and 2 other locations - About 1 hr to fix
thirdparty/flexslider/demo/js/jquery.easing.js on lines 122..123
thirdparty/flexslider/demo/js/jquery.easing.js on lines 129..130

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

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

        if (a < Math.abs(c)) { a=c; var s=p/4; }
        else var s = p/(2*Math.PI) * Math.asin (c/a);
Severity: Major
Found in thirdparty/flexslider/demo/js/jquery.easing.js and 2 other locations - About 1 hr to fix
thirdparty/flexslider/demo/js/jquery.easing.js on lines 129..130
thirdparty/flexslider/demo/js/jquery.easing.js on lines 136..137

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

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

            DropdownField::create(
                'CodeModifierAction',
                _t('OptionItem.CodeModifierAction', 'Code Modification'),
                array(
                    'Add' => _t(
Severity: Major
Found in src/Model/OptionItem.php and 2 other locations - About 1 hr to fix
src/Model/OptionItem.php on lines 178..200
src/Model/OptionItem.php on lines 206..225

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

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

            DropdownField::create(
                'WeightModifierAction',
                _t('OptionItem.WeightModifierAction', 'Weight Modification'),
                array(
                    'Add' => _t(
Severity: Major
Found in src/Model/OptionItem.php and 2 other locations - About 1 hr to fix
src/Model/OptionItem.php on lines 206..225
src/Model/OptionItem.php on lines 231..250

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

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

            DropdownField::create(
                'PriceModifierAction',
                _t('OptionItem.PriceModifierAction', 'Price Modification'),
                array(
                    'Add' => _t(
Severity: Major
Found in src/Model/OptionItem.php and 2 other locations - About 1 hr to fix
src/Model/OptionItem.php on lines 178..200
src/Model/OptionItem.php on lines 231..250

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

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

    private function updateConfig()
    {
        $data = static::config()->get('data');
        $transactionDate = $data['TransactionDate'];
        static::config()->merge('data', [
Severity: Minor
Found in src/Controller/DataTestController.php - About 1 hr to fix

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

        if (slider.vars.manualControls !== "") slider.manualControls = $(slider.vars.manualControls).length > 0 && $(slider.vars.manualControls);
Severity: Major
Found in thirdparty/flexslider/jquery.flexslider.js and 1 other location - About 1 hr to fix
thirdparty/flexslider/jquery.flexslider.js on lines 74..74

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

Severity
Category
Status
Source
Language