wikimedia/mediawiki-extensions-DonationInterface

View on GitHub

Showing 256 of 275 total issues

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

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

    public function execute( $par ) {
        // FIXME: Deprecate "language" param.
        $language = $this->getRequest()->getVal( 'language' );
        $this->showError = $this->getRequest()->getBool( 'showError' );

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 serializeErrors has a Cognitive Complexity of 10 (exceeds 5 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

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

Method setAdapterAndValidate has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function setAdapterAndValidate() {
        $this->ensureState();

        DonationInterface::setSmashPigProvider( $this->gateway );

Severity: Minor
Found in gateway_common/DonationApiBase.php - About 1 hr to fix

    Method post_process has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function post_process() {
            // if the trxn has been outright rejected, log it
            if ( $this->gateway_adapter->getValidationAction() == ValidationAction::REJECT ) {
                $this->log(
                    $this->gateway_adapter->getData_Unstaged_Escaped( 'contribution_tracking_id' ), 'Rejected'
    Severity: Minor
    Found in extras/conversion_log/conversion_log.body.php - About 1 hr to fix

      Method handleOptIn has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function handleOptIn( &$data ) {
              // Since this value can be 1, 0, or unset, we need to make
              // special conditionals for the mustache logic
              if ( !isset( $data['opt_in'] ) || $data['opt_in'] === '' ) {
                  return;
      Severity: Minor
      Found in gateway_forms/Mustache.php - About 1 hr to fix

        Method getNoCacheAction has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function getNoCacheAction() {
                $url = $this->gatewayPage->getRequest()->getFullRequestURL();
                $url_parts = wfParseUrl( $url );
                if ( isset( $url_parts['query'] ) ) {
                    $query_array = wfCgiToArray( $url_parts['query'] );
        Severity: Minor
        Found in gateway_forms/Form.php - About 1 hr to fix

          Function onerror has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              window.onerror = function ( message, file, line, col, error ) {
                  var i, postdata;
                  for ( i = 0; i < ignorePatterns.length; i++ ) {
                      if ( ignoreRegexes.length <= i ) {
                          // turn patterns into regexes the first time through
          Severity: Minor
          Found in modules/js/ext.donationInterface.errorLog.js - About 1 hr to fix

            Function submit has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                di.forms.submit = function () {
                    var paymentMethod = $( '#payment_method' ).val(),
                        isIframe = di.forms.isIframe();
                    if ( !isIframe && paymentMethod !== 'cc' ) {
                        return oldSubmit();
            Severity: Minor
            Found in ingenico_gateway/forms/js/ingenico.js - About 1 hr to fix

              Method createForGateway has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function createForGateway( $gateway, $variant, Config $mwConfig ) {
                      $extensionBaseDir = $mwConfig->get( 'ExtensionDirectory' ) . DIRECTORY_SEPARATOR
                          . 'DonationInterface';
                      /** The following conditional can be deleted when we get rid of WmfFramework */
                      if ( !is_dir( $extensionBaseDir ) ) {
              Severity: Minor
              Found in gateway_common/ConfigurationReader.php - About 1 hr to fix

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

                    public function validate() {
                        $normalized = $this->dataObj->getData();
                
                        if ( $this->transaction_option( 'check_required' ) ) {
                            // The fields returned by getRequiredFields only make sense
                Severity: Minor
                Found in gateway_common/gateway.adapter.php - About 1 hr to fix

                  Method onBeforePageDisplay has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function onBeforePageDisplay( $outputPage, $skin ) {
                          if ( self::isEndowment() ) {
                              // FIXME: need to keep generated CSS in sync with
                              // @see ResourceLoaderSkinModule::getStyles
                              // html body is prepended to give us more-specific selectors
                  Severity: Minor
                  Found in gateway_common/EndowmentHooks.php - About 1 hr to fix

                    Function stage has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function stage( GatewayType $adapter, $normalized, &$stagedData ) {
                            if ( !isset( $normalized['language'] ) ) {
                                return;
                            }
                            $language = $normalized['language'];
                    Severity: Minor
                    Found in gateway_common/DonorLanguage.php - About 55 mins 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 getNoCacheAction has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function getNoCacheAction() {
                            $url = $this->gatewayPage->getRequest()->getFullRequestURL();
                            $url_parts = wfParseUrl( $url );
                            if ( isset( $url_parts['query'] ) ) {
                                $query_array = wfCgiToArray( $url_parts['query'] );
                    Severity: Minor
                    Found in gateway_forms/Form.php - About 55 mins 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 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function execute( $subpage ) {
                            $this->setHeaders();
                            $this->addStylesScriptsAndViewport();
                    
                            $params = $this->getRequest()->getValues();
                    Severity: Minor
                    Found in special/RecurUpgrade.php - About 55 mins 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 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function handleCreatedPayment(
                            CreatePaymentResponse $createPaymentResult, PaymentProvider $provider
                        ): PaymentResult {
                            $transactionStatus = $createPaymentResult->getStatus();
                    
                    
                    Severity: Minor
                    Found in braintree_gateway/braintree.adapter.php - About 55 mins 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 canBypassMinFraud has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function canBypassMinFraud() {
                            // if the data bits data_hash and action are not set, we need to hit minFraud
                            $localdata = $this->gateway_adapter->getData_Unstaged_Escaped();
                            if ( !isset( $localdata['data_hash'] ) || !strlen(
                                    $localdata['data_hash']
                    Severity: Minor
                    Found in extras/custom_filters/filters/minfraud/minfraud.body.php - About 55 mins 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 showMonthlyConvert has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function showMonthlyConvert() {
                            $monthlyConvertAmounts = $this->getMonthlyConvertAmounts();
                            if ( $monthlyConvertAmounts !== null ) {
                                $mcMinimumAmount = $monthlyConvertAmounts[0][0];
                                // check if amount is up to monthly convert minimum amount for specified currency
                    Severity: Minor
                    Found in gateway_common/gateway.adapter.php - About 55 mins 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