Showing 275 of 311 total issues
File gateway.adapter.php
has 1616 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Wikimedia Foundation
*
GatewayAdapter
has 133 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class GatewayAdapter implements GatewayType {
/**
* Don't change these strings without fixing cross-repo usages.
*/
const REDIRECT_PREFACE = 'Redirecting for transaction: ';
File DonationData.php
has 723 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
use SmashPig\Core\DataStores\QueueWrapper;
use SmashPig\Core\SequenceGenerators;
use SmashPig\PaymentData\ReferenceData\CurrencyRates;
use SmashPig\PaymentData\ReferenceData\NationalCurrencies;
Method getFallbacks
has 331 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getFallbacks() {
return [
'aae' => 'sq',
'aao' => 'ar',
'aat' => 'sq',
File adyen.js
has 559 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* global AdyenCheckout, Promise */
( function ( $, mw ) {
// promise objects are for Apple Pay - see comments below
var checkout, onSubmit, authPromise, submitPromise,
configFromServer = mw.config.get( 'adyenConfiguration' ),
File Mustache.php
has 438 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
use LightnCandy\LightnCandy;
use MediaWiki\Extension\CLDR\CountryNames;
use MediaWiki\MediaWikiServices;
Function setupCardForm
has 158 lines of code (exceeds 25 allowed). Consider refactoring. Open
function setupCardForm() {
var dlocalInstance = dlocal( mw.config.get( 'wgDlocalSmartFieldApiKey' ) ),
fields = dlocalInstance.fields( {
locale: mapLang( $( '#language' ).val() ),
country: country
Function chooseGatewayByPriority
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
public function chooseGatewayByPriority( $supportedGateways, $params ) {
$rules = $this->getConfig()->get( 'DonationInterfaceGatewayPriorityRules' );
foreach ( $rules as $rule ) {
// Do our $params match all the conditions for this rule?
- Read upRead up
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 buildOrderIDSources
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
public function buildOrderIDSources() {
static $built = false;
if ( $built && isset( $this->order_id_candidates ) ) { // once per request is plenty
return;
- Read upRead up
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
DonationData
has 44 functions (exceeds 20 allowed). Consider refactoring. Open
class DonationData implements LogPrefixProvider {
/** @var array */
protected $normalized = [];
/** @var array */
protected $dataSources = [];
File adyen_checkout.adapter.php
has 387 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
use Psr\Log\LogLevel;
use SmashPig\Core\PaymentError;
use SmashPig\Core\ValidationError;
File GatewayPage.php
has 384 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Wikimedia Foundation
*
* LICENSE
Function getComponentConfig
has 126 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getComponentConfig( type, checkoutConfig ) {
var config = {};
switch ( type ) {
case 'card':
// Note: Debug messages are only sent and logged server-side if
Function validate_personal
has 125 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.validate_personal = function () {
var value, countryField, emailAdd, invalid, apos, dotpos, domain,
errorsPresent = false,
$formField,
i,
File DataValidator.php
has 372 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
use SmashPig\Core\ValidationError;
/**
Function getSupportedGateways
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
private function getSupportedGateways(
string $country,
?string $currency,
string $paymentMethod,
?string $paymentSubmethod,
- Read upRead up
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
File IngenicoLocale.php
has 336 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Ingenico's connect API returns a 400 BAD REQUEST if the locale string
* doesn't match the xx_YY format. This class tries to find a decent ALPHA2
File dlocal.js
has 324 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*global dlocal:true*/
( function ( $, mw ) {
var country = $( '#country' ).val(),
extraData = {},
isRecurring = !!$( '#recurring' ).val(),
File gravy.adapter.php
has 323 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
use MediaWiki\MediaWikiServices;
use Psr\Log\LogLevel;
use SmashPig\Core\PaymentError;
Function addFormFields
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
protected function addFormFields( &$data ) {
// If any of these are required, show the address block
$address_fields = [
'city',
'state_province',
- Read upRead up
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"