mundipagg/magento2

View on GitHub
view/frontend/web/js/core/checkout/PlatformFormBiding.js

Summary

Maintainability
F
1 wk
Test Coverage

File PlatformFormBiding.js has 489 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var FormObject = {};
var PlatformConfig = {};

PlatformConfig.bind = function (platformConfig) {
    grandTotal = parseFloat(platformConfig.grand_total);
Severity: Minor
Found in view/frontend/web/js/core/checkout/PlatformFormBiding.js - About 7 hrs to fix

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

    FormObject.fillTwoCreditCardsElements = function (containerSelector, elementId, isMultibuyerEnabled) {
    
        if (jQuery(containerSelector).children().length == 0) {
            return;
        }
    Severity: Minor
    Found in view/frontend/web/js/core/checkout/PlatformFormBiding.js - About 1 hr to fix

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

      FormObject.creditCardInit = function (isMultibuyerEnabled) {
      
          this.FormObject = {};
      
          var containerSelector = '#mundipagg_creditcard-form';
      Severity: Minor
      Found in view/frontend/web/js/core/checkout/PlatformFormBiding.js - About 1 hr to fix

        Function voucherInit has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        FormObject.voucherInit = function (isMultibuyerEnabled) {
        
            this.FormObject = {};
        
            var containerSelector = '#mundipagg_voucher-form';
        Severity: Minor
        Found in view/frontend/web/js/core/checkout/PlatformFormBiding.js - About 1 hr to fix

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

          PlatformConfig.getSavedCreditCards = function (platFormConfig) {
              var creditCard = null;
              var twoCreditCard = null;
              var billetCreditCard = null;
              var voucherCard = null;
          Severity: Minor
          Found in view/frontend/web/js/core/checkout/PlatformFormBiding.js - About 1 hr to fix

            Function bind has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            PlatformConfig.bind = function (platformConfig) {
                grandTotal = parseFloat(platformConfig.grand_total);
            
                publicKey = platformConfig.payment.ccform.pk_token;
            
            
            Severity: Minor
            Found in view/frontend/web/js/core/checkout/PlatformFormBiding.js - About 1 hr to fix

              Function boletoCreditCardInit has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              FormObject.boletoCreditCardInit = function (isMultibuyerEnabled) {
              
                  var containerBoletoSelector = "#mundipagg_billet_creditcard-form #billet-form";
                  var containerCreditCardSelector = "#mundipagg_billet_creditcard-form #credit-card-form";
              
              
              Severity: Minor
              Found in view/frontend/web/js/core/checkout/PlatformFormBiding.js - About 1 hr to fix

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

                FormObject.pixInit = function (isMultibuyerEnabled) {
                
                    this.FormObject = {};
                
                    var containerSelector = '#mundipagg_pix-form';
                Severity: Minor
                Found in view/frontend/web/js/core/checkout/PlatformFormBiding.js - About 1 hr to fix

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

                  FormObject.boletoInit = function (isMultibuyerEnabled) {
                  
                      this.FormObject = {};
                  
                      var containerSelector = '#mundipagg_billet-form';
                  Severity: Minor
                  Found in view/frontend/web/js/core/checkout/PlatformFormBiding.js - About 1 hr to fix

                    Function debitInit has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    FormObject.debitInit = function (isMultibuyerEnabled) {
                    
                        this.FormObject = {};
                    
                        var containerSelector = '#mundipagg_debit-form';
                    Severity: Minor
                    Found in view/frontend/web/js/core/checkout/PlatformFormBiding.js - About 1 hr to fix

                      Function getAvaliableBrands has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      PlatformConfig.getAvaliableBrands = function (data) {
                          creditCardBrands = this.getBrands(
                              data,
                              data.payment.ccform.availableTypes.mundipagg_creditcard
                          );
                      Severity: Minor
                      Found in view/frontend/web/js/core/checkout/PlatformFormBiding.js - About 1 hr to fix

                        Function getSavedCreditCards has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                        PlatformConfig.getSavedCreditCards = function (platFormConfig) {
                            var creditCard = null;
                            var twoCreditCard = null;
                            var billetCreditCard = null;
                            var voucherCard = null;
                        Severity: Minor
                        Found in view/frontend/web/js/core/checkout/PlatformFormBiding.js - About 35 mins 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

                        FormObject.pixInit = function (isMultibuyerEnabled) {
                        
                            this.FormObject = {};
                        
                            var containerSelector = '#mundipagg_pix-form';
                        Severity: Major
                        Found in view/frontend/web/js/core/checkout/PlatformFormBiding.js and 1 other location - About 2 days to fix
                        view/frontend/web/js/core/checkout/PlatformFormBiding.js on lines 342..382

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

                        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

                        FormObject.boletoInit = function (isMultibuyerEnabled) {
                        
                            this.FormObject = {};
                        
                            var containerSelector = '#mundipagg_billet-form';
                        Severity: Major
                        Found in view/frontend/web/js/core/checkout/PlatformFormBiding.js and 1 other location - About 2 days to fix
                        view/frontend/web/js/core/checkout/PlatformFormBiding.js on lines 300..340

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

                        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 creditCardForm = {
                                'containerSelector' : containerSelector,
                                "creditCardNumber" : jQuery(containerSelector + " .cc_number"),
                                "creditCardHolderName" : jQuery(containerSelector + " .cc_owner"),
                                "creditCardExpMonth" : jQuery(containerSelector + " .cc_exp_month"),
                        Severity: Major
                        Found in view/frontend/web/js/core/checkout/PlatformFormBiding.js and 1 other location - About 6 hrs to fix
                        view/frontend/web/js/core/checkout/PlatformFormBiding.js on lines 402..416

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

                        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 cardsElements = {
                                'containerSelector' : containerCreditCardSelector,
                                "creditCardNumber" : jQuery(containerCreditCardSelector + " .cc_number"),
                                "creditCardHolderName" : jQuery(containerCreditCardSelector + " .cc_owner"),
                                "creditCardExpMonth" : jQuery(containerCreditCardSelector + " .cc_exp_month"),
                        Severity: Major
                        Found in view/frontend/web/js/core/checkout/PlatformFormBiding.js and 1 other location - About 6 hrs to fix
                        view/frontend/web/js/core/checkout/PlatformFormBiding.js on lines 122..136

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

                        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 voucherForm = {
                                'containerSelector' : containerSelector,
                                "creditCardNumber" : jQuery(containerSelector + " .cc_number"),
                                "creditCardHolderName" : jQuery(containerSelector + " .cc_owner"),
                                "creditCardExpMonth" : jQuery(containerSelector + " .cc_exp_month"),
                        Severity: Major
                        Found in view/frontend/web/js/core/checkout/PlatformFormBiding.js and 1 other location - About 6 hrs to fix
                        view/frontend/web/js/core/checkout/PlatformFormBiding.js on lines 229..242

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

                        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 debitForm = {
                                'containerSelector' : containerSelector,
                                "creditCardNumber" : jQuery(containerSelector + " .cc_number"),
                                "creditCardHolderName" : jQuery(containerSelector + " .cc_owner"),
                                "creditCardExpMonth" : jQuery(containerSelector + " .cc_exp_month"),
                        Severity: Major
                        Found in view/frontend/web/js/core/checkout/PlatformFormBiding.js and 1 other location - About 6 hrs to fix
                        view/frontend/web/js/core/checkout/PlatformFormBiding.js on lines 176..189

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

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

                            if (
                                platFormConfig.payment.mundipagg_billet_creditcard.enabled_saved_cards &&
                                typeof(platFormConfig.payment.mundipagg_billet_creditcard.cards != "undefined")
                            ) {
                                billetCreditCard = platFormConfig.payment.mundipagg_billet_creditcard.cards;
                        Severity: Major
                        Found in view/frontend/web/js/core/checkout/PlatformFormBiding.js and 4 other locations - About 1 hr to fix
                        view/frontend/web/js/core/checkout/PlatformFormBiding.js on lines 553..558
                        view/frontend/web/js/core/checkout/PlatformFormBiding.js on lines 560..565
                        view/frontend/web/js/core/checkout/PlatformFormBiding.js on lines 567..572
                        view/frontend/web/js/core/checkout/PlatformFormBiding.js on lines 581..586

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

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

                            if (
                                platFormConfig.payment.mundipagg_debit.enabled_saved_cards &&
                                typeof(platFormConfig.payment.mundipagg_debit.cards != "undefined")
                            ) {
                                debitCard = platFormConfig.payment.mundipagg_debit.cards;
                        Severity: Major
                        Found in view/frontend/web/js/core/checkout/PlatformFormBiding.js and 4 other locations - About 1 hr to fix
                        view/frontend/web/js/core/checkout/PlatformFormBiding.js on lines 553..558
                        view/frontend/web/js/core/checkout/PlatformFormBiding.js on lines 560..565
                        view/frontend/web/js/core/checkout/PlatformFormBiding.js on lines 567..572
                        view/frontend/web/js/core/checkout/PlatformFormBiding.js on lines 574..579

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

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

                            if (
                                platFormConfig.payment.mundipagg_voucher.enabled_saved_cards &&
                                typeof(platFormConfig.payment.mundipagg_voucher.cards != "undefined")
                            ) {
                                voucherCard = platFormConfig.payment.mundipagg_voucher.cards;
                        Severity: Major
                        Found in view/frontend/web/js/core/checkout/PlatformFormBiding.js and 4 other locations - About 1 hr to fix
                        view/frontend/web/js/core/checkout/PlatformFormBiding.js on lines 553..558
                        view/frontend/web/js/core/checkout/PlatformFormBiding.js on lines 567..572
                        view/frontend/web/js/core/checkout/PlatformFormBiding.js on lines 574..579
                        view/frontend/web/js/core/checkout/PlatformFormBiding.js on lines 581..586

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

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

                            if (
                                platFormConfig.payment.mundipagg_creditcard.enabled_saved_cards &&
                                typeof(platFormConfig.payment.mundipagg_creditcard.cards != "undefined")
                            ) {
                                creditCard = platFormConfig.payment.mundipagg_creditcard.cards;
                        Severity: Major
                        Found in view/frontend/web/js/core/checkout/PlatformFormBiding.js and 4 other locations - About 1 hr to fix
                        view/frontend/web/js/core/checkout/PlatformFormBiding.js on lines 560..565
                        view/frontend/web/js/core/checkout/PlatformFormBiding.js on lines 567..572
                        view/frontend/web/js/core/checkout/PlatformFormBiding.js on lines 574..579
                        view/frontend/web/js/core/checkout/PlatformFormBiding.js on lines 581..586

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

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

                            if (
                                platFormConfig.payment.mundipagg_two_creditcard.enabled_saved_cards &&
                                typeof(platFormConfig.payment.mundipagg_two_creditcard.cards != "undefined")
                            ) {
                                twoCreditCard = platFormConfig.payment.mundipagg_two_creditcard.cards;
                        Severity: Major
                        Found in view/frontend/web/js/core/checkout/PlatformFormBiding.js and 4 other locations - About 1 hr to fix
                        view/frontend/web/js/core/checkout/PlatformFormBiding.js on lines 553..558
                        view/frontend/web/js/core/checkout/PlatformFormBiding.js on lines 560..565
                        view/frontend/web/js/core/checkout/PlatformFormBiding.js on lines 574..579
                        view/frontend/web/js/core/checkout/PlatformFormBiding.js on lines 581..586

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

                        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