Showing 275 of 311 total issues
Function validate
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public static function validate( GatewayType $gateway, $data, $check_not_empty = [] ) {
// return the array of errors that should be generated on validate.
// just the same way you'd do it if you were a form passing the error array around.
/**
- 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 validate_personal
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
window.validate_personal = function () {
var value, countryField, emailAdd, invalid, apos, dotpos, domain,
errorsPresent = false,
$formField,
i,
- 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 dlocal.adapter.php
has 312 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
use MediaWiki\MediaWikiServices;
use Psr\Log\LogLevel;
use SmashPig\Core\PaymentError;
Function displayResultsForDebug
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
protected function displayResultsForDebug( ?PaymentTransactionResponse $results = null ) {
$results = !$results ? $this->adapter->getTransactionResponse() : $results;
if ( $this->adapter->getGlobal( 'DisplayDebug' ) !== true ) {
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
Function getFormFields
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public function getFormFields( ?array $knownData = null ): array {
if ( $knownData === null ) {
$knownData = $this->getData_Unstaged_Escaped();
}
$fields = [];
- 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 EmailPreferences.php
has 305 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
use MediaWiki\Extension\CLDR\CountryNames;
use MediaWiki\Extension\CLDR\LanguageNames;
use SmashPig\Core\DataStores\QueueWrapper;
Function callDonateApi
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
function callDonateApi( successCallback, extraData, action ) {
di.forms.disable();
di.forms.clean();
$( '#topError' ).html( '' );
$( '#errorReference' )
Method execute
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute() {
if ( RequestContext::getMain()->getUser()->pingLimiter( 'submitpayment' ) ) {
// Allow rate limiting by setting e.g. $wgRateLimits['submitpayment']['ip']
return;
}
Method validate
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function validate( GatewayType $gateway, $data, $check_not_empty = [] ) {
// return the array of errors that should be generated on validate.
// just the same way you'd do it if you were a form passing the error array around.
/**
Function sift3Distance
has a Cognitive Complexity of 22 (exceeds 5 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;
- 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 session_resetOnSwitch
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
protected function session_resetOnSwitch() {
$oldData = $this->session_getData( 'Donor' );
if ( !is_array( $oldData ) ) {
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
DataValidator
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class DataValidator {
/**
* getErrorToken, intended to be used by classes that exist relatively close
* to the form classes, returns the error token (defined on the forms) that
Function processDonorReturn
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function processDonorReturn( $requestValues ) {
// FIXME: make sure we're processing the order ID we expect!
/** @var HostedCheckoutProvider $provider */
$provider = $this->getPaymentProvider();
'@phan-var HostedCheckoutProvider $provider';
- 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
Method execute
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute( $par ) {
// FIXME: Deprecate "language" param.
$language = $this->getRequest()->getVal( 'language' );
$this->showError = $this->getRequest()->getBool( 'showError' );
Function addSubmethods
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
protected function addSubmethods( &$data ) {
if ( !$this->gatewayPage->showSubmethodButtons() ) {
$data['show_submethods'] = false;
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
Function getDonationRules
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function getDonationRules(): array {
$rules = $this->config['donation_rules'];
foreach ( $rules as $rule ) {
// Do our $params match all the conditions for this rule?
$ruleMatches = true;
- 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 amazon.js
has 281 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*global amazon:true, OffAmazonPayments:true*/
( function ( $, mw ) {
var clientId = mw.config.get( 'wgAmazonGatewayClientID' ),
sellerId = mw.config.get( 'wgAmazonGatewaySellerID' ),
sandbox = mw.config.get( 'wgAmazonGatewaySandbox' ),
Method execute
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute() {
$this->gateway = 'amazon';
DonationInterface::setSmashPigProvider( 'amazon' );
$output = $this->getResult();
$recurring = $this->getParameter( 'recurring' );
Method handleCreatedPayment
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function handleCreatedPayment(
IPaymentProvider $provider, PaymentDetailResponse $authorizeResult
): PaymentResult {
$transactionStatus = $authorizeResult->getStatus();
$responseData = [
Method handleResultRequest
has 65 lines of code (exceeds 25 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;