wikimedia/mediawiki-extensions-DonationInterface

View on GitHub

Showing 256 of 275 total issues

Function session_resetForNewAttempt has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function session_resetForNewAttempt( $force = false ) {
        $reset = $force;
        if ( $this->session_getData( 'numAttempt' ) > 3 ) {
            $reset = true;
            WmfFramework::setSessionValue( 'numAttempt', 0 );
Severity: Minor
Found in gateway_common/gateway.adapter.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 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function execute( $par ) {
        // Bow out if gateway chooser is not enabled
        if ( !$this->getConfig()->get( 'DonationInterfaceEnableGatewayChooser' ) ) {
            throw new BadTitleError();
        }
Severity: Minor
Found in special/GatewayChooser.php - About 1 hr to fix

    Method session_resetOnSwitch has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function session_resetOnSwitch() {
            $oldData = $this->session_getData( 'Donor' );
            if ( !is_array( $oldData ) ) {
                return;
            }
    Severity: Minor
    Found in gateway_common/gateway.adapter.php - About 1 hr to fix

      Method session_resetForNewAttempt has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function session_resetForNewAttempt( $force = false ) {
              $reset = $force;
              if ( $this->session_getData( 'numAttempt' ) > 3 ) {
                  $reset = true;
                  WmfFramework::setSessionValue( 'numAttempt', 0 );
      Severity: Minor
      Found in gateway_common/gateway.adapter.php - About 1 hr to fix

        Function setLocaleAndTranslations has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function setLocaleAndTranslations( config, localeFromServer ) {
                // Adyen supports the locales listed below, according to
                // https://docs.adyen.com/online-payments/web-components/localization-components#supported-languages
                var adyenSupportedLocale = [
                    'zh-CN', 'zh-TW', 'hr-HR', 'cs-CZ',
        Severity: Minor
        Found in adyen_gateway/forms/adyen.js - About 1 hr to fix

          Method getMessageFields has 46 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function getMessageFields() {
                  return [
                      'contribution_tracking_id',
                      'anonymous',
                      'utm_source',
          Severity: Minor
          Found in gateway_common/DonationData.php - About 1 hr to fix

            Method defineTransactions has 45 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function defineTransactions() {
                    $this->transactions = [];
            
                    // https://developer.paypal.com/docs/classic/api/merchant/SetExpressCheckout_API_Operation_NVP/
                    $this->transactions['SetExpressCheckout'] = [
            Severity: Minor
            Found in paypal_ec_gateway/paypal_express.adapter.php - About 1 hr to fix

              Method getLocalizedValidationErrorResult has 45 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function getLocalizedValidationErrorResult( array $validationErrors ): PaymentResult {
                      $localizedErrors = [];
                      foreach ( $validationErrors as $error ) {
                          $field = $error->getField();
                          $debugMessage = $error->getDebugMessage();
              Severity: Minor
              Found in braintree_gateway/braintree.adapter.php - About 1 hr to fix

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

                    function createWalletWidget() {
                        var params = {
                            sellerId: sellerId,
                            onReady: function ( billingAgreement ) {
                                if ( !cardSelected ) {
                Severity: Minor
                Found in amazon_gateway/amazon.js - About 1 hr to fix

                  Method execute has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function execute( $subpage ) {
                          $this->setHeaders();
                          $this->outputHeader();
                          $out = $this->getOutput();
                  
                  
                  Severity: Minor
                  Found in special/EmailPreferences.php - About 1 hr to fix

                    Function filter has a Cognitive Complexity of 14 (exceeds 5 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

                    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 processDonorReturn has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function processDonorReturn( $requestValues ) {
                            if (
                                empty( $requestValues['token'] )
                            ) {
                                throw new ResponseProcessingException(
                    Severity: Minor
                    Found in paypal_ec_gateway/paypal_express.adapter.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 fallbackToDefaultCurrency has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function fallbackToDefaultCurrency() {
                            $defaultCurrency = null;
                            if ( $this->getGlobal( 'FallbackCurrencyByCountry' ) ) {
                                $country = $this->dataObj->getVal( 'country' );
                                if ( $country !== null ) {
                    Severity: Minor
                    Found in gateway_common/gateway.adapter.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 getCleanTrackingData has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function getCleanTrackingData( $unset = false ) {
                            // define valid tracking fields
                            $tracking_fields = [
                                'amount',
                                'appeal',
                    Severity: Minor
                    Found in gateway_common/DonationData.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 handleCreatedPayment has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function handleCreatedPayment(
                            PaymentDetailResponse $paymentDetailResponse,
                            IPaymentProvider $paymentProvider
                        ): PaymentResult {
                            // Log details of the payment in case we need to reconstruct it for
                    Severity: Minor
                    Found in dlocal_gateway/dlocal.adapter.php - About 1 hr to fix

                      Method setUtmSource has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function setUtmSource() {
                              $utm_source = $this->getVal( 'utm_source' );
                              $utm_source_id = $this->getVal( 'utm_source_id' );
                      
                              if ( $this->getVal( 'payment_method' ) ) {
                      Severity: Minor
                      Found in gateway_common/DonationData.php - About 1 hr to fix

                        Method paramsForRecurUpgradeForm has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected function paramsForRecurUpgradeForm( $checksum, $contactID, $country ): ?array {
                                $recurData = CiviproxyConnect::getRecurDetails( $checksum, $contactID );
                                if ( $recurData[ 'is_error' ] ) {
                                    $logger = self::getLogger();
                        
                        
                        Severity: Minor
                        Found in special/RecurUpgrade.php - About 1 hr to fix

                          Method getEmailPreferences has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public static function getEmailPreferences( $checksum, $contact_id ) {
                                  global $wgDonationInterfaceCiviproxyURLBase;
                          
                                  $client = new GuzzleHttp\Client();
                                  $logger = DonationLoggerFactory::getLoggerFromParams(
                          Severity: Minor
                          Found in extras/civiproxy/CiviproxyConnect.php - About 1 hr to fix

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

                                public function doPayment() {
                                    $this->ensureUniqueOrderID();
                                    $this->session_addDonorData();
                                    $this->setCurrentTransaction( 'authorize' );
                                    Gateway_Extras_CustomFilters::onGatewayReady( $this );
                            Severity: Minor
                            Found in adyen_gateway/adyen_checkout.adapter.php - About 1 hr to fix

                              Method defineTransactions has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  protected function defineTransactions() {
                                      $this->transactions = [
                                          'authorize' => [
                                              'request' => [
                                                  'amount',
                              Severity: Minor
                              Found in dlocal_gateway/dlocal.adapter.php - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language