wikimedia/wikimedia-fundraising-SmashPig

View on GitHub

Showing 476 of 476 total issues

Function getPayerInfo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function getPayerInfo( array $row, string $info, bool $isChargeBack = false ) : ?string {
        if ( !$isChargeBack && $row['paymentMethodSnapshot'] ) {
            $payerBlock = $row['paymentMethodSnapshot'];
        } elseif ( $isChargeBack && $row['transaction']['paymentMethodSnapshot'] ) {
            $payerBlock = $row['transaction']['paymentMethodSnapshot'];
Severity: Minor
Found in PaymentProviders/Braintree/Maintenance/SearchTransactions.php - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        $logger = Logger::getTaggedLogger( "corr_id-adyen-{$this->merchantReference}" );
        $logger->info(
            "Recording successful capture on account '{$this->account}' with authorization reference " .
                "'{$this->gatewayTxnId}' and order ID '{$this->merchantReference}'."
Severity: Minor
Found in PaymentProviders/Adyen/Jobs/RecordCaptureJob.php - About 25 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 refundPayment has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function refundPayment( array $params ): RefundPaymentResponse {
        try {
            if ( empty( $params['gateway_txn_id'] ) ) {
                return DlocalRefundPaymentResponseFactory::fromErrorResponse( [
                    'error' => 'Missing required fields'
Severity: Minor
Found in PaymentProviders/dlocal/PaymentProvider.php - About 25 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 createPayment has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function createPayment( array $params ): CreatePaymentResponse {
        // re-fetch email info for venmo
        if ( !empty( $params['gateway_session_id'] ) && empty( $params['email'] ) ) {
            Logger::info( 'No email passed, fetch again with gateway_session_id: ' . $params['gateway_session_id'] );
            $donorDetails = $this->fetchCustomerData( $params['gateway_session_id'] );
Severity: Minor
Found in PaymentProviders/Braintree/VenmoPaymentProvider.php - About 25 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 shouldRetry has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function shouldRetry( array $parsedResponse ): bool {
        if ( $parsedResponse['status'] === Response::HTTP_FORBIDDEN ) {
            $body = $parsedResponse['body'];
            Logger::warning( "Request returned (403) FORBIDDEN: $body" );
            return false;
Severity: Minor
Found in PaymentProviders/dlocal/RestResponseValidator.php - About 25 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 throwOnAdyenError has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function throwOnAdyenError( $adyenResponse ) {
        $exceptionCode = null;
        $exceptionMessage = null;

        if ( $adyenResponse === null ) {
Severity: Minor
Found in PaymentProviders/Adyen/ExceptionMapper.php - About 25 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 loadConfigFromPaths has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function loadConfigFromPaths( array $searchPath ) {
        $paths = $this->expandSearchPathToActual( $searchPath );

        // Reset to empty set.
        $this->options = [];
Severity: Minor
Found in Core/Configuration.php - About 25 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 approvePayment has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function approvePayment( array $params ): ApprovePaymentResponse {
        $rawResponse = $this->api->doExpressCheckoutPayment( $params );
        $response = new ApprovePaymentResponse();
        $response->setRawResponse( $rawResponse );

Severity: Minor
Found in PaymentProviders/PayPal/PaymentProvider.php - About 25 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 parseRefund has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function parseRefund( DOMElement $recordNode, string $type, string $gateway ): array {
        $record = $this->xmlToArray( $recordNode, $this->refundMap );
        $record['type'] = $type;

        // deal with negative EffortID
Severity: Minor
Found in PaymentProviders/Ingenico/Audit/IngenicoAudit.php - About 25 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 getNext has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getNext() {
        if ( !$this->connection ) {
            $this->connect();
        }
        $this->connection->beginTransaction();
Severity: Minor
Found in Core/SequenceGenerators/SqlSequenceGenerator.php - About 25 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 is_reject has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function is_reject() {
        foreach ( $this->providerConfiguration->val( 'rejects' ) as $key => $val ) {
            if ( isset( $this->payload->{$key} ) ) {
                $values = (array)$val;
                if ( in_array( $this->payload->{$key}, $values, true ) ) {
Severity: Minor
Found in PaymentProviders/PayPal/Job.php - About 25 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 deleteDataForPayment has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function deleteDataForPayment( string $gatewayTransactionId ): DeleteDataResponse {
        $rawResponse = $this->api->deleteDataForPayment( $gatewayTransactionId );
        $response = new DeleteDataResponse();
        $response->setRawResponse( $rawResponse );
        if ( !isset( $rawResponse['result'] ) ) {
Severity: Minor
Found in PaymentProviders/Adyen/PaymentProvider.php - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        /**
         * @var PaymentProvider
         */
        $adyen = PaymentProviderFactory::getProviderForMethod( $this->getOption( 'method' ) );
Severity: Minor
Found in PaymentProviders/Adyen/Maintenance/TestAdyenRecurring.php - About 25 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 normalizeMessage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function normalizeMessage( &$message, $ipnMessage ) {
        if (
            $ipnMessage['txn_type'] === 'express_checkout' ||
            (
                $ipnMessage['txn_type'] === 'cart' &&
Severity: Minor
Found in PaymentProviders/PayPal/PaymentMessage.php - About 25 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 setBody has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function setBody( $data ): OutboundRequest {
        if ( is_array( $data ) ) {
            $this->body = http_build_query( $data );
        } else {
            $this->body = $data;
Severity: Minor
Found in Core/Http/OutboundRequest.php - About 25 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 getOriginalDateOrDefault has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getOriginalDateOrDefault( $message, $default = 0 ) {
        // This is the actual queued time
        if ( isset( $message['source_enqueued_time'] ) ) {
            // This is only ever set to the numeric timestamp
            return $message['source_enqueued_time'];
Severity: Minor
Found in CrmLink/Messages/DateFields.php - About 25 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