wikimedia/mediawiki-extensions-DonationInterface

View on GitHub

Showing 275 of 311 total issues

Function findClosestDomain has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  findClosestDomain: function(domain, domains, distanceFunction, threshold) {
    threshold = threshold || this.topLevelThreshold;
    var dist;
    var minDist = 99;
    var closestDomain = null;
Severity: Minor
Found in modules/js/mailcheck.js - About 1 hr 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 execute has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute( $par ) {
        $this->getOutput()->setPageTitle( 'Payment Settings' );

        // this config comes from the config in extension.json
        //$config = $this->getConfig()->get( 'DonationInterfaceGatewayPriorityRules' );
Severity: Minor
Found in special/PaymentSettings.php - About 1 hr 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 isEnabled has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public static function isEnabled( $rule, $currency, $country ) {
        $country = strtoupper( $country );
        $currency = strtoupper( $currency );
        $isEnabled = false;
        if ( array_key_exists( $currency, $rule ) ) {
Severity: Minor
Found in gateway_common/CurrencyCountryRule.php - About 1 hr 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 handleResultRequest has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    protected function handleResultRequest() {
        // no longer letting people in without these things. If this is
        // preventing you from doing something, you almost certainly want to be
        // somewhere else.
        $deadSession = false;
Severity: Minor
Found in gateway_common/ResultSwitcher.php - About 1 hr 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 execute has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function execute( $subpage ) {
        $this->setHeaders();
        $this->addStylesScriptsAndViewport();

        $params = $this->getRequest()->getValues();
Severity: Minor
Found in special/RecurUpgrade.php - About 1 hr to fix

    Method validate has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function validate( GatewayType $adapter, $normalized, &$errors ) {
            global $wgDonationInterfaceForbiddenCountries;
            $hasCountryCode = false;
            $country = '';
    
    
    Severity: Minor
    Found in gateway_common/CountryValidation.php - About 1 hr to fix

      Method doPayment has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function doPayment() {
              $this->ensureUniqueOrderID();
              $this->session_addDonorData();
              $this->runDoPaymentFilters();
              if ( !$this->filterActionIsProcess() ) {
      Severity: Minor
      Found in gravy_gateway/gravy.adapter.php - About 1 hr to fix

        Method render has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function render( $fileName, $data, $options = [] ) {
                $defaultOptions = [
                    'flags' => LightnCandy::FLAG_ERROR_EXCEPTION | LightnCandy::FLAG_ADVARNAME,
                ];
                if ( isset( $options['flags'] ) ) {
        Severity: Minor
        Found in gateway_forms/MustacheHelper.php - About 1 hr to fix

          Method canBypassMinFraud has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function canBypassMinFraud() {
                  // if the data bits data_hash and action are not set, we need to hit minFraud
                  $localdata = $this->gateway_adapter->getData_Unstaged_Escaped();
                  if ( !isset( $localdata['data_hash'] ) || !strlen(
                          $localdata['data_hash']
          Severity: Minor
          Found in extras/custom_filters/filters/minfraud/minfraud.body.php - About 1 hr to fix

            Method filter has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function filter() {
                    // see if we can bypass minFraud
                    if ( $this->canBypassMinFraud() ) {
                        return true;
                    }
            Severity: Minor
            Found in extras/custom_filters/filters/minfraud/minfraud.body.php - About 1 hr to fix

              Function exports has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              module.exports = function ( grunt ) {
                  var conf = grunt.file.readJSON( 'extension.json' );
                  grunt.loadNpmTasks( 'grunt-banana-checker' );
                  grunt.loadNpmTasks( 'grunt-eslint' );
                  grunt.loadNpmTasks( 'grunt-stylelint' );
              Severity: Minor
              Found in Gruntfile.js - About 1 hr to fix

                Function postMonthlyConvertDonate has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    mc.postMonthlyConvertDonate = function ( amount, declineMonthlyConvert ) {
                        var sendData = mc.getSendData( amount );
                        if ( declineMonthlyConvert ) {
                            sendData.declineMonthlyConvert = declineMonthlyConvert;
                        }
                Severity: Minor
                Found in modules/js/ext.donationInterface.monthlyConvert.js - About 1 hr to fix

                  Method showMonthlyConvert has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function showMonthlyConvert() {
                          $monthlyConvertAmounts = $this->getMonthlyConvertAmounts();
                          if ( $monthlyConvertAmounts !== null ) {
                              $mcMinimumAmount = $monthlyConvertAmounts[0][0];
                              // check if amount is up to monthly convert minimum amount for specified currency
                  Severity: Minor
                  Found in gateway_common/gateway.adapter.php - About 1 hr to fix

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

                      splitEmail: function(email) {
                        var parts = email.trim().split('@');
                    
                        if (parts.length < 2) {
                          return false;
                    Severity: Minor
                    Found in modules/js/mailcheck.js - About 1 hr to fix

                      Method filter has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function filter( $filterListGlobal ) {
                              $functions = $this->gateway_adapter->getGlobal( $filterListGlobal );
                      
                              if (
                                  !$this->gateway_adapter->getGlobal( 'EnableFunctionsFilter' ) ||
                      Severity: Minor
                      Found in extras/custom_filters/filters/functions/functions.body.php - About 1 hr to fix

                        Method executeRecurUpgrade has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected function executeRecurUpgrade( $params ) {
                                $logger = self::getLogger();
                                $donorData = WmfFramework::getSessionValue( self::DONOR_DATA );
                                if ( !isset( $donorData['contribution_recur_id'] ) ) {
                                    $this->renderError( $params );
                        Severity: Minor
                        Found in special/RecurUpgrade.php - About 1 hr to fix

                          Method addGatewaySpecificResources has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              protected function addGatewaySpecificResources( $out ): void {
                                  $script = $this->adapter->getAccountConfig( 'Script' );
                                  $css = $this->adapter->getAccountConfig( 'Css' );
                                  if ( $this->adapter->getPaymentMethod() == 'google' ) {
                                      $googleScript = $this->adapter->getAccountConfig( 'GoogleScript' );
                          Severity: Minor
                          Found in adyen_gateway/adyen_checkout_gateway.body.php - About 1 hr to fix

                            Method doPayment has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function doPayment() {
                                    $this->setValidationAction( ValidationAction::PROCESS, true );
                                    $this->logger->debug( 'Running onGatewayReady filters' );
                                    Gateway_Extras_CustomFilters::onGatewayReady( $this );
                                    if ( $this->getValidationAction() != ValidationAction::PROCESS ) {
                            Severity: Minor
                            Found in paypal_ec_gateway/paypal_express.adapter.php - About 1 hr to fix

                              Method getForm has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function getForm() {
                                      $options = [
                                          'helpers' => [
                                              'l10n' => 'EmailForm::l10n',
                                              'dateFormatter' => 'EmailForm::dateFormatter',
                              Severity: Minor
                              Found in email_forms/EmailForm.php - 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
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language