wikimedia/mediawiki-extensions-DonationInterface

View on GitHub

Showing 275 of 275 total issues

Function session_resetOnSwitch has a Cognitive Complexity of 22 (exceeds 5 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 3 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

DataValidator has 26 functions (exceeds 20 allowed). Consider refactoring.
Open

class DataValidator {

    /**
     * getErrorToken, intended to be used by classes that exist relatively close
     * to the form classes, returns the error token (defined on the forms) that
Severity: Minor
Found in gateway_common/DataValidator.php - About 3 hrs to fix

    Function processDonorReturn has a Cognitive Complexity of 21 (exceeds 5 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: Minor
    Found in ingenico_gateway/ingenico.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

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

        public function execute( $par ) {
            // FIXME: Deprecate "language" param.
            $language = $this->getRequest()->getVal( 'language' );
            $this->showError = $this->getRequest()->getBool( 'showError' );
    
    
    Severity: Major
    Found in gateway_common/GatewayPage.php - About 2 hrs to fix

      Function addSubmethods has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function addSubmethods( &$data ) {
              if ( !$this->gatewayPage->showSubmethodButtons() ) {
                  $data['show_submethods'] = false;
                  return;
              }
      Severity: Minor
      Found in gateway_forms/Mustache.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 getDonationRules has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getDonationRules(): array {
              $rules = $this->config['donation_rules'];
              foreach ( $rules as $rule ) {
                  // Do our $params match all the conditions for this rule?
                  $ruleMatches = true;
      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

      File amazon.js has 281 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*global amazon:true, OffAmazonPayments:true*/
      ( function ( $, mw ) {
          var clientId = mw.config.get( 'wgAmazonGatewayClientID' ),
              sellerId = mw.config.get( 'wgAmazonGatewaySellerID' ),
              sandbox = mw.config.get( 'wgAmazonGatewaySandbox' ),
      Severity: Minor
      Found in amazon_gateway/amazon.js - About 2 hrs to fix

        Method handleCreatedPayment has 65 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function handleCreatedPayment(
                IPaymentProvider $provider, PaymentDetailResponse $authorizeResult
            ): PaymentResult {
                $transactionStatus = $authorizeResult->getStatus();
                $responseData = [
        Severity: Major
        Found in adyen_gateway/adyen_checkout.adapter.php - About 2 hrs to fix

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

              public function execute() {
                  $this->gateway = 'amazon';
                  DonationInterface::setSmashPigProvider( 'amazon' );
                  $output = $this->getResult();
                  $recurring = $this->getParameter( 'recurring' );
          Severity: Major
          Found in amazon_gateway/amazon.api.php - About 2 hrs to fix

            Method handleResultRequest has 65 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function handleResultRequest() {
                    // no longer letting people in without these things. If this is
                    // preventing you from doing something, you almost certainly want to be
                    // somewhere else.
                    $deadSession = false;
            Severity: Major
            Found in gateway_common/ResultSwitcher.php - About 2 hrs to fix

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

                    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 paramsForPreferencesForm has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function paramsForPreferencesForm( $checksum, $contact_id ) {
                              $prefs = CiviproxyConnect::getEmailPreferences( $checksum, $contact_id );
                      
                              if ( $prefs[ 'is_error' ] ) {
                                  $logger = DonationLoggerFactory::getLoggerFromParams(
                      Severity: Major
                      Found in special/EmailPreferences.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(
                                  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 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

                          Severity
                          Category
                          Status
                          Source
                          Language