wikimedia/mediawiki-extensions-DonationInterface

View on GitHub

Showing 275 of 311 total issues

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

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

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

              Method cc_number_exists_in_str has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function cc_number_exists_in_str( string $str ): bool {
                      $luhnRegex = <<<EOT
              /
              (?#amex)(3[47][0-9]{13})|
              (?#bankcard)(5610[0-9]{12})|(56022[1-5][0-9]{10})|
              Severity: Minor
              Found in gateway_common/DataValidator.php - About 1 hr to fix

                Method setNormalizedAmount has 40 lines of code (exceeds 25 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

                  Function updateResponseData has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function updateResponseData( PaymentDetailResponse $authorizeResult ) {
                          $responseData = [];
                  
                          // Add the gravy-generated transaction ID to the DonationData object
                          // to be sent to the queues
                  Severity: Minor
                  Found in gravy_gateway/gravy.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 getErrors has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function getErrors() {
                          $errors = $this->gateway->getErrorState()->getErrors();
                          $return = [ 'errors' => [
                              'general' => [],
                              'field' => [],
                  Severity: Minor
                  Found in gateway_forms/Mustache.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 validateAmount has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                  window.validateAmount = function () {
                      var error = true,
                          amount = $( 'input[name="amount"]' ).val(), // get the amount
                          currency = '',
                          rates = mw.config.get( 'wgDonationInterfaceCurrencyRates' ),
                  Severity: Minor
                  Found in modules/validate_input.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 validateDataConstraintsMet has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function validateDataConstraintsMet( $field, $value ) {
                          $met = true;
                  
                          if ( is_array( $this->dataConstraints ) && array_key_exists( $field, $this->dataConstraints ) ) {
                              $type = $this->dataConstraints[$field]['type'];
                  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 setUtmSource has a Cognitive Complexity of 13 (exceeds 5 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

                  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 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function validate( GatewayType $adapter, $normalized, &$errors ) {
                          if (
                              !isset( $normalized['amount'] ) ||
                              !isset( $normalized['currency'] )
                          ) {
                  Severity: Minor
                  Found in gateway_common/Amount.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 setClientVariables has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function setClientVariables( &$vars ) {
                          $language = $this->adapter->getData_Unstaged_Escaped( 'language' );
                          $country = $this->adapter->getData_Unstaged_Escaped( 'country' );
                          $vars['wgDonationInterfaceAmountRules'] = $this->adapter->getDonationRules();
                          $vars['wgDonationInterfaceLogDebug'] = $this->adapter->getGlobal( 'LogDebug' );
                  Severity: Minor
                  Found in gateway_common/GatewayPage.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 stage has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function stage( GatewayType $adapter, $normalized, &$staged_data ) {
                          if ( isset( $normalized['language'] ) && isset( $normalized['country'] ) ) {
                              $language = $normalized['language'];
                              // Get the first part, before any _ or - separator.
                              foreach ( [ '_', '-' ] as $separator ) {
                  Severity: Minor
                  Found in gateway_common/DonorLocale.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 getErrors has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function getErrors() {
                          $errors = $this->gateway->getErrorState()->getErrors();
                          $return = [ 'errors' => [
                              'general' => [],
                              'field' => [],
                  Severity: Minor
                  Found in gateway_forms/Mustache.php - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language