wikimedia/mediawiki-extensions-DonationInterface

View on GitHub

Showing 256 of 275 total issues

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

          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 __construct has 29 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 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 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

                    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

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

                      module.exports = function ( grunt ) {
                          grunt.loadNpmTasks( 'grunt-banana-checker' );
                          grunt.loadNpmTasks( 'grunt-eslint' );
                          grunt.loadNpmTasks( 'grunt-stylelint' );
                      
                      
                      Severity: Minor
                      Found in Gruntfile.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 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

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

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

                                Severity
                                Category
                                Status
                                Source
                                Language