wikimedia/mediawiki-extensions-DonationInterface

View on GitHub

Showing 275 of 311 total issues

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

    public function getAvailableSubmethods() {
        $method = $this->getPaymentMethod();
        $isRecurring = $this->getData_Unstaged_Escaped( 'recurring' );
        $country = $this->getData_Unstaged_Escaped( 'country' );
        $methodSupportsRecurring = $method ? $this->getPaymentMethodMeta( $method )['recurring'] : false;
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 getTransactionSpecificValue has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function getTransactionSpecificValue( $gateway_field_name ) {
        if ( !$this->transactions ) {
            $msg = self::getGatewayName() . ': Transactions structure is empty! No transaction can be constructed.';
            $this->logger->critical( $msg );
            throw new LogicException( $msg );
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 validate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function validate( GatewayType $adapter, $normalized, &$errors ) {
        global $wgDonationInterfaceForbiddenCountries;
        $hasCountryCode = false;
        $country = '';

Severity: Minor
Found in gateway_common/CountryValidation.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 validate has a Cognitive Complexity of 9 (exceeds 5 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 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 handleDonationRequest has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected function handleDonationRequest() {
        $this->setHeaders();

        // TODO: This is where we should feed GPCS parameters into the gateway
        // and DonationData, rather than harvest params in the adapter itself.
Severity: Minor
Found in gateway_common/GatewayPage.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

Function filter has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    private function filter() {
        $user_ip = $this->gateway_adapter->getData_Unstaged_Escaped( 'user_ip' );

        // Determine IP status before doing anything complex
        $wl = DataValidator::ip_is_listed( $user_ip, $this->gateway_adapter->getGlobal( 'IPAllowList' ) );
Severity: Minor
Found in extras/session_velocity/session_velocity.body.php - About 45 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

Method getSupportedGateways has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

        string $country,
        ?string $currency,
        string $paymentMethod,
        ?string $paymentSubmethod,
        bool $recurring,
Severity: Minor
Found in special/GatewayChooser.php - About 45 mins to fix

    Function validate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function validate( array $params, $posted ) {
            if ( !$this->validateEmail( $params, $posted ) ) {
                return false;
            }
            if ( !$this->validateToken( $params, $posted ) ) {
    Severity: Minor
    Found in special/EmailPreferences.php - About 45 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 validate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function validate( GatewayType $adapter, $normalized, &$errors ) {
            // validate() is called at various points in the process. We only want to require these
            // parameters for card payments, and only during the 'donate' action (not during initial
            // form load nor during recurring upgrade). It's a bit odd to find the action in the
            // $normalized array, but there it is!
    Severity: Minor
    Found in adyen_gateway/EncryptedCardParameters.php - About 45 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 handleOptIn has a Cognitive Complexity of 8 (exceeds 5 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 45 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 validate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function validate( GatewayType $adapter, $normalized, &$errors ) {
            global $wgDonationInterfaceDlocalStreetNumberLengthRequirements;
            $country = $normalized['country'] ?? '';
            $rules = [];
            $street_number = $normalized['street_number'] ?? '';
    Severity: Minor
    Found in gateway_common/StreetNumberValidation.php - About 45 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 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function stage( GatewayType $adapter, $normalized, &$stagedData ) {
            if ( !empty( $normalized['return_url'] ) ) {
                $returnto = $normalized['return_url'];
            } else {
                $returnto = '';
    Severity: Minor
    Found in ingenico_gateway/IngenicoReturnUrlHelper.php - About 45 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 integrateDataFromSession has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function integrateDataFromSession() {
            /**
             * if the thing coming in from the session isn't already something,
             * replace it.
             * if it is: assume that the session data was meant to be replaced
    Severity: Minor
    Found in gateway_common/DonationData.php - About 45 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 validate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function validate( GatewayType $adapter, $normalized, &$errors ) {
            global $wgDonationInterfaceDlocalStreetLengthRequirements;
            $country = $normalized['country'] ?? '';
            $rules = [];
            $street_address = $normalized['street_address'] ?? '';
    Severity: Minor
    Found in gateway_common/StreetAddressValidation.php - About 45 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_postal_code has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function stage_postal_code( $normalized ) {
            $postalCode = '';
            if ( isset( $normalized['postal_code'] ) ) {
                $postalCode = trim( $normalized['postal_code'] );
            }
    Severity: Minor
    Found in gateway_common/StreetAddress.php - About 45 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 luhn_check has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function luhn_check( $str ) {
            $odd = ( strlen( $str ) % 2 );
            $sum = 0;
            $len = strlen( $str );
    
    
    Severity: Minor
    Found in gateway_common/DataValidator.php - About 45 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 validate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function validate( GatewayType $adapter, $normalized, &$errors ) {
            global $wgDonationInterfaceDlocalPostalCodeLengthRequirements;
            $country = $normalized['country'] ?? '';
            $rules = [];
            $postal_code = $normalized['postal_code'] ?? '';
    Severity: Minor
    Found in gateway_common/PostalCodeValidation.php - About 45 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 onerror has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        window.onerror = function ( message, file, line, col, error ) {
    Severity: Minor
    Found in modules/js/ext.donationInterface.errorLog.js - About 35 mins to fix

      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
        Severity
        Category
        Status
        Source
        Language