wikimedia/mediawiki-extensions-DonationInterface

View on GitHub

Showing 266 of 302 total issues

Method validate has 37 lines of code (exceeds 25 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 1 hr to fix

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

      Method setCountry has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function setCountry() {
              $regen = true;
              $country = '';
      
              if ( $this->isSomething( 'country' ) ) {
      Severity: Minor
      Found in gateway_common/DonationData.php - About 1 hr to fix

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

            public function execute() {
                if ( RequestContext::getMain()->getUser()->pingLimiter( 'submitpayment' ) ) {
                    // Allow rate limiting by setting e.g. $wgRateLimits['submitpayment']['ip']
                    return;
                }
        Severity: Minor
        Found in adyen_gateway/adyen_submit_payment.api.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 defineTransactions has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function defineTransactions() {
                $this->transactions = [
                    TransactionType::AUTHORIZE => [
                        'request' => [
                            'amount',
        Severity: Minor
        Found in braintree_gateway/braintree.adapter.php - About 1 hr to fix

          Function sift3Distance has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            sift3Distance: function(s1, s2) {
              // sift3: http://siderite.blogspot.com/2007/04/super-fast-and-accurate-string-distance.html
              if (s1 == null || s1.length === 0) {
                if (s2 == null || s2.length === 0) {
                  return 0;
          Severity: Minor
          Found in modules/js/mailcheck.js - About 1 hr to fix

            Method getData has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function getData() {
                    $data = $this->gateway->getData_Unstaged_Escaped();
                    $output = $this->gatewayPage->getContext()->getOutput();
            
                    $data['script_path'] = $this->scriptPath;
            Severity: Minor
            Found in gateway_forms/Mustache.php - About 1 hr to fix

              Function validateInputs has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      function validateInputs() {
                          var formValid = mw.donationInterface.validation.validate(),
                              cvvFieldHasErrors = cvvFieldError || cvvFieldEmpty,
                              cardFieldHasErrors = cardFieldError || cardFieldEmpty || cardFieldSupportError,
                              expFieldHasErrors = expirationFieldError || expirationFieldEmpty,
              Severity: Minor
              Found in dlocal_gateway/forms/dlocal.js - About 1 hr to fix

                Method normalizeOrderID has 33 lines of code (exceeds 25 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 1 hr to fix

                  Method getCheckoutConfiguration has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function getCheckoutConfiguration() {
                          $provider = PaymentProviderFactory::getProviderForMethod(
                              $this->getPaymentMethod()
                          );
                          '@phan-var PaymentProvider $provider';
                  Severity: Minor
                  Found in adyen_gateway/adyen_checkout.adapter.php - About 1 hr to fix

                    Function paramsForPreferencesForm has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

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

                        public function execute() {
                            $this->gateway = 'amazon';
                            DonationInterface::setSmashPigProvider( 'amazon' );
                            $output = $this->getResult();
                            $recurring = $this->getParameter( 'recurring' );
                    Severity: Minor
                    Found in amazon_gateway/amazon.api.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 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function execute( $subpage ) {
                            $this->setHeaders();
                            $this->outputHeader();
                            $out = $this->getOutput();
                    
                    
                    Severity: Minor
                    Found in special/EmailPreferences.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 updateResponseData has a Cognitive Complexity of 11 (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 findClosestDomain has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                      findClosestDomain: function(domain, domains, distanceFunction, threshold) {
                        threshold = threshold || this.topLevelThreshold;
                        var dist;
                        var minDist = 99;
                        var closestDomain = null;
                    Severity: Minor
                    Found in modules/js/mailcheck.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 splitEmail has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                      splitEmail: function(email) {
                        var parts = email.trim().split('@');
                    
                        if (parts.length < 2) {
                          return false;
                    Severity: Minor
                    Found in modules/js/mailcheck.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 stage has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function stage( GatewayType $adapter, $normalized, &$stagedData ) {
                            // If any address field is not blank, fill in blanks with 'NA'
                            // if all fields are blank, leave it alone
                            foreach ( self::$addressFields as $address ) {
                                if ( !empty( $normalized[ $address ] ) ) {
                    Severity: Minor
                    Found in adyen_gateway/BlankAddressFields.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 isEnabled has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static function isEnabled( $rule, $currency, $country ) {
                            $country = strtoupper( $country );
                            $currency = strtoupper( $currency );
                            $isEnabled = false;
                            if ( array_key_exists( $currency, $rule ) ) {
                    Severity: Minor
                    Found in gateway_common/CurrencyCountryRule.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 handleResultRequest has a Cognitive Complexity of 11 (exceeds 5 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: Minor
                    Found in gateway_common/ResultSwitcher.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 postMonthlyConvertDonate has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        mc.postMonthlyConvertDonate = function ( amount, declineMonthlyConvert ) {
                            var sendData = mc.getSendData( amount ),
                                url;
                            if ( declineMonthlyConvert ) {
                                sendData.declineMonthlyConvert = declineMonthlyConvert;
                    Severity: Minor
                    Found in modules/js/ext.donationInterface.monthlyConvert.js - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language