wikimedia/mediawiki-extensions-DonationInterface

View on GitHub
dlocal_gateway/forms/dlocal.js

Summary

Maintainability
F
3 days
Test Coverage

Function setupCardForm has 158 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function setupCardForm() {
        var dlocalInstance = dlocal( mw.config.get( 'wgDlocalSmartFieldApiKey' ) ),
            fields = dlocalInstance.fields( {
                locale: mapLang( $( '#language' ).val() ),
                country: country
Severity: Major
Found in dlocal_gateway/forms/dlocal.js - About 6 hrs to fix

    File dlocal.js has 330 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*global dlocal:true*/
    ( function ( $, mw ) {
        var country = $( '#country' ).val(),
            extraData = {},
            isRecurring = !!$( '#recurring' ).val(),
    Severity: Minor
    Found in dlocal_gateway/forms/dlocal.js - About 3 hrs to fix

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

              function validateInputs() {
                  var formValid = mw.donationInterface.validation.validate(),
                      cvvFieldHasErrors = cvvFieldError || cvvFieldEmpty,
                      cardFieldHasErrors = cardFieldError || cardFieldEmpty || cardFieldSupportError,
                      expFieldHasErrors = expirationFieldError || expirationFieldEmpty,
      Severity: Minor
      Found in dlocal_gateway/forms/dlocal.js - About 1 hr to fix

        Function addCardFieldEvents has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                function addCardFieldEvents() {
                    cardField.addEventListener( 'change', function ( event ) {
                        cardFieldError = !!event.error;
                        if ( event.error ) {
                            $( '#cardNumberErrorMsg' ).text( mw.msg( 'donate_interface-error-msg-unsupported-card-entered' ) );
        Severity: Minor
        Found in dlocal_gateway/forms/dlocal.js - About 1 hr to fix

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

                  function addCvvFieldEvents() {
                      cvvField.addEventListener( 'change', function ( event ) {
                          cvvFieldError = !!event.error;
                          if ( event.error ) {
                              $( '#cvvErrorMsg' ).text( mw.msg( 'donate_interface-error-msg-invalid-cvv-format' ) );
          Severity: Major
          Found in dlocal_gateway/forms/dlocal.js and 1 other location - About 4 hrs to fix
          dlocal_gateway/forms/dlocal.js on lines 117..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 123.

          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

                  function addExpirationFieldEvents() {
                      expirationField.addEventListener( 'change', function ( event ) {
                          expirationFieldError = !!event.error;
                          if ( event.error ) {
                              $( '#expirationErrorMsg' ).text( mw.msg( 'donate_interface-error-msg-card-too-old' ) );
          Severity: Major
          Found in dlocal_gateway/forms/dlocal.js and 1 other location - About 4 hrs to fix
          dlocal_gateway/forms/dlocal.js on lines 132..145

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

          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 ( result.isFailed ) {
                      mw.donationInterface.validation.showErrors( {
                          general: mw.msg( 'donate_interface-error-msg-general' )
                      } );
                  } else if ( mw.monthlyConvert && mw.monthlyConvert.canShowModal() ) {
          Severity: Major
          Found in dlocal_gateway/forms/dlocal.js and 1 other location - About 3 hrs to fix
          adyen_gateway/forms/adyen.js on lines 436..459

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

          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 ( expFieldHasErrors ) {
                              if ( expirationFieldEmpty ) {
                                  errors.expiration = mw.msg( 'donate_interface-error-msg-expiration' );
                              } else {
                                  errors.expiration = mw.msg( 'donate_interface-error-msg-card-too-old' );
          Severity: Major
          Found in dlocal_gateway/forms/dlocal.js and 1 other location - About 1 hr to fix
          dlocal_gateway/forms/dlocal.js on lines 164..170

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

          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 ( cvvFieldHasErrors ) {
                              if ( cvvFieldEmpty ) {
                                  errors.cvv = mw.msg( 'donate_interface-error-msg-cvv' );
                              } else {
                                  errors.cvv = mw.msg( 'donate_interface-error-msg-invalid-cvv-format' );
          Severity: Major
          Found in dlocal_gateway/forms/dlocal.js and 1 other location - About 1 hr to fix
          dlocal_gateway/forms/dlocal.js on lines 171..177

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

          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