wikimedia/mediawiki-extensions-DonationInterface

View on GitHub

Showing 275 of 311 total issues

Function validate has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    public function validate( GatewayType $unused, $normalized, &$errors ) {
        if (
            !isset( $normalized['country'] ) ||
            !isset( $normalized[self::$key] )
        ) {
Severity: Minor
Found in gateway_common/FiscalNumber.php - About 2 hrs 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 setCountry has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    protected function setCountry() {
        $regen = true;
        $country = '';

        if ( $this->isSomething( 'country' ) ) {
Severity: Minor
Found in gateway_common/DonationData.php - About 2 hrs 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 processDonorReturn has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function processDonorReturn( $requestValues ) {
        if (
            empty( $requestValues['token'] )
        ) {
            throw new ResponseProcessingException(
Severity: Major
Found in paypal_ec_gateway/paypal_express.adapter.php - About 2 hrs to fix

    File minfraud.body.php has 273 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * Wikimedia Foundation
     *
     * LICENSE
    Severity: Minor
    Found in extras/custom_filters/filters/minfraud/minfraud.body.php - About 2 hrs to fix

      Method paramsForPreferencesForm has 62 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function paramsForPreferencesForm( $checksum, $contact_id ) {
              $preferences = CiviproxyConnect::getEmailPreferences( $checksum, $contact_id );
      
              if ( $preferences[ 'is_error' ] ) {
                  $logger = DonationLoggerFactory::getLoggerFromParams(
      Severity: Major
      Found in special/EmailPreferences.php - About 2 hrs to fix

        Function createAndMountComponent has 62 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function createAndMountComponent( config, component_type, containerName ) {
                var component_config = getComponentConfig( component_type, config ),
                    component = checkout.create( component_type, component_config );
        
                if ( component_type === GOOGLEPAY_COMPONENT_TYPE ) {
        Severity: Major
        Found in adyen_gateway/forms/adyen.js - About 2 hrs to fix

          Method processDonorReturn has 62 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function processDonorReturn( $requestValues ) {
                  // FIXME: make sure we're processing the order ID we expect!
                  /** @var HostedCheckoutProvider $provider */
                  $provider = $this->getPaymentProvider();
                  '@phan-var HostedCheckoutProvider $provider';
          Severity: Major
          Found in ingenico_gateway/ingenico.adapter.php - About 2 hrs to fix

            File amazon.adapter.php has 268 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            use PayWithAmazon\PaymentsClientInterface as PwaClientInterface;
            use Psr\Log\LogLevel;
            use SmashPig\Core\Context;
            Severity: Minor
            Found in amazon_gateway/amazon.adapter.php - About 2 hrs to fix

              Function handleCreatedPayment has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function handleCreatedPayment(
                      IPaymentProvider $provider, PaymentDetailResponse $authorizeResult
                  ): PaymentResult {
                      $transactionStatus = $authorizeResult->getStatus();
                      $responseData = [
              Severity: Minor
              Found in adyen_gateway/adyen_checkout.adapter.php - About 2 hrs 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 handleCreatedPayment has a Cognitive Complexity of 18 (exceeds 5 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 2 hrs 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 calculateKeyMashScore has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function calculateKeyMashScore( $stringToCheck ) {
                      $letters = str_split( strtolower( $stringToCheck ) );
                      $rules = $this->getGlobal( 'NameFilterRules' );
                      $score = 0;
              
              
              Severity: Minor
              Found in gateway_common/gateway.adapter.php - About 2 hrs 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 getQueueDonationMessage has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function getQueueDonationMessage(): array {
                      $gatewayTxnId = $this->getData_Unstaged_Escaped( 'gateway_txn_id' );
                      if ( $gatewayTxnId === null ) {
                          $gatewayTxnId = false;
                      }
              Severity: Minor
              Found in gateway_common/gateway.adapter.php - About 2 hrs 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 setupCardForm has 60 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function setupCardForm() {
                      secureFields = new SecureFields( {
                          gr4vyId: gravyId,
                          environment: environment,
                          sessionId: sessionId,
              Severity: Major
              Found in gravy_gateway/forms/gravy.js - About 2 hrs to fix

                Method getRecurDetails has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static function getRecurDetails( $checksum, $contact_id ) {
                        global $wgDonationInterfaceCiviproxyURLBase;
                
                        $client = new GuzzleHttp\Client();
                        $params = [
                Severity: Major
                Found in extras/civiproxy/CiviproxyConnect.php - About 2 hrs to fix

                  Method buildOrderIDSources has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function buildOrderIDSources() {
                          static $built = false;
                  
                          if ( $built && isset( $this->order_id_candidates ) ) { // once per request is plenty
                              return;
                  Severity: Major
                  Found in gateway_common/gateway.adapter.php - About 2 hrs to fix

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

                        public function validate( GatewayType $adapter, $normalized, &$errors ) {
                            if (
                                !isset( $normalized['amount'] ) ||
                                !isset( $normalized['currency'] )
                            ) {
                    Severity: Major
                    Found in gateway_common/Amount.php - About 2 hrs to fix

                      GravyAdapter has 22 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class GravyAdapter extends GatewayAdapter implements RecurringConversion {
                          use RecurringConversionTrait;
                      
                          /**
                           * @var string
                      Severity: Minor
                      Found in gravy_gateway/gravy.adapter.php - About 2 hrs to fix

                        GatewayPage has 22 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        abstract class GatewayPage extends UnlistedSpecialPage {
                            /**
                             * flag for setting Monthly Convert modal on template
                             * @var bool
                             */
                        Severity: Minor
                        Found in gateway_common/GatewayPage.php - About 2 hrs to fix

                          Function init has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              mc.init = function () {
                                  var presetAmount,
                                      locale = $( '#language' ).val() + '-' + $( '#country' ).val();
                                  originalAmount = +$( '#amount' ).val();
                                  currency = $( '#currency' ).val();
                          Severity: Major
                          Found in modules/js/ext.donationInterface.monthlyConvert.js - About 2 hrs to fix

                            Method getFormFields has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function getFormFields( ?array $knownData = null ): array {
                                    if ( $knownData === null ) {
                                        $knownData = $this->getData_Unstaged_Escaped();
                                    }
                                    $fields = [];
                            Severity: Major
                            Found in gateway_common/gateway.adapter.php - About 2 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language