wikimedia/mediawiki-extensions-DonationInterface

View on GitHub

Showing 256 of 275 total issues

Method addArrayElement has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    protected static function addArrayElement( &$targetElement, $structureElement, $key, $value, $callback ) {
Severity: Minor
Found in gateway_common/ArrayHelper.php - About 35 mins to fix

    Function paramsForRecurUpgradeForm has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function paramsForRecurUpgradeForm( $checksum, $contactID, $country ): ?array {
            $recurData = CiviproxyConnect::getRecurDetails( $checksum, $contactID );
            if ( $recurData[ 'is_error' ] ) {
                $logger = self::getLogger();
    
    
    Severity: Minor
    Found in special/RecurUpgrade.php - About 35 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 getPartials has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function getPartials( array $data ) {
            $partials = [];
            if ( empty( $data['variant'] ) ) {
                $variantDir = false;
            } else {
    Severity: Minor
    Found in gateway_forms/Mustache.php - About 35 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 suggest has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      suggest: function(email, domains, topLevelDomains, distanceFunction) {
        email = email.toLowerCase();
    
        var emailParts = this.splitEmail(email);
    
    
    Severity: Minor
    Found in modules/js/mailcheck.js - About 35 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 render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function render( $fileName, $data, $options = [] ) {
            $defaultOptions = [
                'flags' => LightnCandy::FLAG_ERROR_EXCEPTION | LightnCandy::FLAG_ADVARNAME,
            ];
            if ( isset( $options['flags'] ) ) {
    Severity: Minor
    Found in gateway_forms/MustacheHelper.php - About 35 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 validateAmount has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function validateAmount( array $params, bool $posted ): bool {
            if ( !$posted || ( isset( $params['submit'] ) && $params['submit'] === 'cancel' ) ) {
                // Not doing anything with the parameters unless we're posted, so don't worry about them
                return true;
            }
    Severity: Minor
    Found in includes/RecurUpgrade/Validator.php - About 35 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 processDonorReturn has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function processDonorReturn( $requestValues ): PaymentResult {
            // DLocal currently does not send us the correct return parameters
            // on coming back from recurring UPI (at least in sandbox).
            // In any case, we don't want to send a message to the donations
            // queue from the front-end for recurring UPI because we need to
    Severity: Minor
    Found in dlocal_gateway/dlocal.adapter.php - About 35 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 addHitToVelocityData has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        protected static function addHitToVelocityData( $stored = false, $timeout = false ): array {
            $new_velocity_records = [];
            $nowstamp = time();
            if ( is_array( $stored ) ) {
                foreach ( $stored as $timestamp ) {
    Severity: Minor
    Found in extras/custom_filters/filters/ip_velocity/ip_velocity.body.php - About 35 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 languageSpecificFallback has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function languageSpecificFallback(
            $language = 'en', $msg_keys = [], $params = []
        ) {
            if ( count( $msg_keys ) < 1 ) {
                throw new InvalidArgumentException( __FUNCTION__ . " BAD PROGRAMMER. No message keys given." );
    Severity: Minor
    Found in gateway_common/MessageUtils.php - About 35 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 setNormalizedRecurring has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function setNormalizedRecurring() {
            if ( $this->isSomething( 'recurring_paypal' ) && ( $this->getVal( 'recurring_paypal' ) === '1' || $this->getVal( 'recurring_paypal' ) === 'true' ) ) {
                $this->setVal( 'recurring', true );
                $this->expunge( 'recurring_paypal' );
            }
    Severity: Minor
    Found in gateway_common/DonationData.php - About 35 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 checkValidationPassed has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        protected static function checkValidationPassed( $fields, $results ) {
            foreach ( $fields as $field ) {
                foreach ( $results as $phase => $results_fields ) {
                    if ( array_key_exists( $field, $results_fields )
                        && $results_fields[$field] !== true
    Severity: Minor
    Found in gateway_common/DataValidator.php - About 35 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 getClientSideValidation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getClientSideValidation( $normalized, &$clientRules ) {
            if (
                !isset( $normalized['country'] ) ||
                empty( self::$countryRules[$normalized['country']] )
            ) {
    Severity: Minor
    Found in gateway_common/FiscalNumber.php - About 35 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 hasValidationError has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function hasValidationError( $field = null ) {
            foreach ( $this->errors as $error ) {
                if ( $error instanceof ValidationError ) {
                    if ( $field === null || $error->getField() === $field ) {
                        return true;
    Severity: Minor
    Found in gateway_common/ErrorState.php - About 35 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 trimFieldToConstraints has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function trimFieldToConstraints( $value, $field ) {
            // Trim all values if they are a string
            $value = is_string( $value ) ? trim( $value ) : $value;
    
            if ( isset( $this->dataConstraints[$field] ) && is_string( $value ) ) {
    Severity: Minor
    Found in gateway_common/gateway.adapter.php - About 35 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 setAdapterAndValidate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function setAdapterAndValidate() {
            $this->ensureState();
    
            DonationInterface::setSmashPigProvider( $this->gateway );
    
    
    Severity: Minor
    Found in gateway_common/DonationApiBase.php - About 35 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 finalizeInternalStatus has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function finalizeInternalStatus( $status ) {
            /**
             * Handle session stuff!
             * -Behavior-
             * * Always, always increment numAttempt.
    Severity: Minor
    Found in gateway_common/gateway.adapter.php - About 35 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 populateData has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function populateData( $external_data = false ) {
            $this->normalized = [];
            if ( is_array( $external_data ) ) {
                // I don't care if you're a test or not. At all.
                $this->normalized = $external_data;
    Severity: Minor
    Found in gateway_common/DonationData.php - About 35 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

    Avoid too many return statements within this method.
    Open

                        return;
    Severity: Major
    Found in adyen_gateway/adyen_submit_payment.api.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return true;
      Severity: Major
      Found in includes/RecurUpgrade/Validator.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                        return '';
        Severity: Major
        Found in adyen_gateway/adyen_submit_payment.api.php - About 30 mins to fix
          Severity
          Category
          Status
          Source
          Language