wikimedia/mediawiki-extensions-DonationInterface

View on GitHub

Showing 275 of 311 total issues

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

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

    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

      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

        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

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

                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

                    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 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 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 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 tuneForPaymentMethod has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function tuneForPaymentMethod() {
                            switch ( $this->getPaymentMethod() ) {
                                case 'dd':
                                    $this->transactions['authorize']['request'] =
                                        array_merge( $this->transactions['authorize']['request'], [
                    Severity: Minor
                    Found in adyen_gateway/adyen_checkout.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 addArrayElement has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected static function addArrayElement( &$targetElement, $structureElement, $key, $value, $callback ) {
                            if ( is_numeric( $key ) ) {
                                // it's just a value, not an associative array key
                                $fieldName = $value;
                                $fieldValue = $callback( $fieldName );
                    Severity: Minor
                    Found in gateway_common/ArrayHelper.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 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 normalizeOrderID has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function normalizeOrderID( $override = null, $dataObj = null ) {
                            $selected = false;
                            $source = null;
                            $value = null;
                            if ( $override !== null && $this->validateDataConstraintsMet( 'order_id', $override ) ) {
                    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

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

                        public static function value_appears_in( $needle, $haystack ) {
                            $needle = ( is_array( $needle ) ) ? $needle : [ $needle ];
                            $haystack = ( is_array( $haystack ) ) ? $haystack : [ $haystack ];
                    
                            $plusCheck = array_key_exists( '+', $haystack );
                    Severity: Minor
                    Found in gateway_common/DataValidator.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