wikimedia/mediawiki-extensions-DonationInterface

View on GitHub

Showing 275 of 311 total issues

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

    protected function renderResponse( PaymentResult $result ) {
        if ( $result->isFailed() ) {
            $this->logger->info( 'Displaying fail page for failed PaymentResult' );
            $this->displayFailPage();
            return;
Severity: Minor
Found in gateway_common/GatewayPage.php - About 1 hr to fix

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

        public function getTransactionSpecificValue( $gateway_field_name ) {
            if ( !$this->transactions ) {
                $msg = self::getGatewayName() . ': Transactions structure is empty! No transaction can be constructed.';
                $this->logger->critical( $msg );
                throw new LogicException( $msg );
    Severity: Minor
    Found in gateway_common/gateway.adapter.php - About 1 hr to fix

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

          protected function getEmployersList() {
              $employersListDataFile = $this->getConfig()->get( 'DonationInterfaceEmployersListDataFileLocation' );
              // Check the employer data file exists
              if ( !file_exists( $employersListDataFile ) ) {
                  $this->setError( 'Employer data file doesn\'t exist: ' . $employersListDataFile );
      Severity: Minor
      Found in gateway_common/employerSearch.api.php - About 1 hr to fix

        Method sendToContributionTracking has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function sendToContributionTracking() {
                // build utm key, looks like pay the fee is still taken from that
                if ( $this->donationData['pay_the_fee'] === 1 ) {
                    $this->donationData['utm_key'] = 'ptf_1';
                }
        Severity: Minor
        Found in adyen_gateway/adyen_submit_payment.api.php - About 1 hr to fix

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

              public function doPayment() {
                  $this->ensureUniqueOrderID();
                  $this->session_addDonorData();
                  $this->setCurrentTransaction( TransactionType::AUTHORIZE );
                  Gateway_Extras_CustomFilters::onGatewayReady( $this );
          Severity: Minor
          Found in braintree_gateway/braintree.adapter.php - About 1 hr to fix

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

                function validateInputs() {
                    var formValid = mw.donationInterface.validation.validate(),
                        errors = {};
            
                    if ( !formValid || !secureFieldValid ) {
            Severity: Minor
            Found in gravy_gateway/forms/gravy.js - About 1 hr to fix

              Method getFieldsToRemove has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function getFieldsToRemove( ?array $knownData = null ) {
                      $method = $knownData['payment_method'] ?? $this->getData_Unstaged_Escaped( 'payment_method' );
                      $submethod = $knownData['payment_submethod'] ?? $this->getData_Unstaged_Escaped( 'payment_submethod' );
                      if ( $method === 'apple' ) {
                          // For Apple Pay, do not require any of the following fields in forms,
              Severity: Minor
              Found in adyen_gateway/adyen_checkout.adapter.php - About 1 hr to fix

                Method __construct has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function __construct( $options = [] ) {
                        $defaults = [
                            'external_data' => null,
                            'variant' => null,
                        ];
                Severity: Minor
                Found in gateway_common/gateway.adapter.php - About 1 hr to fix

                  Method getThankYouPage has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function getThankYouPage( GatewayType $adapter, $extraParams = [] ) {
                          $page = $adapter::getGlobal( "ThankYouPage" );
                          if ( $page ) {
                              $page = self::appendLanguageAndMakeURL(
                                  $page,
                  Severity: Minor
                  Found in gateway_common/ResultPages.php - About 1 hr to fix

                    Method finalizeInternalStatus has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function finalizeInternalStatus( $status ) {
                            /**
                             * Handle session stuff!
                             * -Behavior-
                             * * Always, always increment numAttempt.
                    Severity: Minor
                    Found in gateway_common/gateway.adapter.php - About 1 hr to fix

                      Method normalize has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function normalize() {
                              // FIXME: there's a ghost invocation during DonationData construction.
                              // This condition should actually be "did data come from anywhere?"
                              if ( $this->normalized ) {
                                  // Cast all values to string.
                      Severity: Minor
                      Found in gateway_common/DonationData.php - About 1 hr to fix

                        Method serializeErrors has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected function serializeErrors( $errors ) {
                                $serializedErrors = [];
                                foreach ( $errors as $error ) {
                                    if ( $error instanceof ValidationError ) {
                                        $country = $this->adapter->getData_Unstaged_Escaped( 'country' );
                        Severity: Minor
                        Found in gateway_common/DonationApiBase.php - About 1 hr to fix

                          Function healthCheck has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                              protected function healthCheck( Score $response ) {
                                  global $wgEmergencyContact;
                          
                                  if ( isset( $response->queriesRemaining ) ) {
                                      $queries = intval( $response->queriesRemaining );
                          Severity: Minor
                          Found in extras/custom_filters/filters/minfraud/minfraud.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 addGatewaySpecificResources has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                              protected function addGatewaySpecificResources( OutputPage $out ): void {
                                  if ( $this->isDirectPaymentFlow() ) {
                                      $out->addJsConfigVars( 'isDirectPaymentFlow', true );
                                      if ( $this->isCreditCard() ) {
                                          $dlocalScript = $this->adapter->getAccountConfig( 'dlocalScript' );
                          Severity: Minor
                          Found in dlocal_gateway/dlocal_gateway.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 withExtraFields has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                              protected function withExtraFields( $data, $query ) {
                                  foreach ( self::$extraFieldsMap as $section => $fields ) {
                                      foreach ( $fields as $ourName => $theirName ) {
                                          if ( in_array( $ourName, $this->enabledExtraFields ) ) {
                                              if ( !empty( $data[$ourName] ) ) {
                          Severity: Minor
                          Found in extras/custom_filters/filters/minfraud/minfraud.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 validate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function validate( array $params, bool $posted ): bool {
                                  if (
                                      empty( $params['checksum'] ) ||
                                      empty( $params['contact_id'] ) ||
                                      !is_numeric( $params['contact_id'] )
                          Severity: Minor
                          Found in includes/RecurUpgrade/Validator.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 execute has a Cognitive Complexity of 10 (exceeds 5 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

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

                              public static function getByCountry( $country ) {
                                  if ( isset( self::$list[$country] ) ) {
                                      $divisions = self::$list[$country];
                          
                                      // Localize subdivisions where possible
                          Severity: Minor
                          Found in gateway_forms/includes/Subdivisions.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 doRecurringConversion has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function doRecurringConversion(): PaymentResult {
                                  $sessionData = $this->session_getData( 'Donor' );
                                  if (
                                      empty( $sessionData['recurring_payment_token'] ) ||
                                      empty( $sessionData['gateway_txn_id'] )
                          Severity: Minor
                          Found in gateway_common/RecurringConversionTrait.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 setNormalizedAmount has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                              protected function setNormalizedAmount() {
                                  if ( $this->getVal( 'amount' ) === 'Other' ) {
                                      $this->setVal( 'amount', $this->getVal( 'amountGiven' ) );
                                  }
                          
                          
                          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

                          Severity
                          Category
                          Status
                          Source
                          Language