Showing 275 of 311 total issues
Function findClosestDomain
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
findClosestDomain: function(domain, domains, distanceFunction, threshold) {
threshold = threshold || this.topLevelThreshold;
var dist;
var minDist = 99;
var closestDomain = null;
- 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 execute
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function execute( $par ) {
$this->getOutput()->setPageTitle( 'Payment Settings' );
// this config comes from the config in extension.json
//$config = $this->getConfig()->get( 'DonationInterfaceGatewayPriorityRules' );
- 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 isEnabled
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function isEnabled( $rule, $currency, $country ) {
$country = strtoupper( $country );
$currency = strtoupper( $currency );
$isEnabled = false;
if ( array_key_exists( $currency, $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 handleResultRequest
has a Cognitive Complexity of 11 (exceeds 5 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;
- 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 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute( $subpage ) {
$this->setHeaders();
$this->addStylesScriptsAndViewport();
$params = $this->getRequest()->getValues();
Method validate
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function validate( GatewayType $adapter, $normalized, &$errors ) {
global $wgDonationInterfaceForbiddenCountries;
$hasCountryCode = false;
$country = '';
Method doPayment
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function doPayment() {
$this->ensureUniqueOrderID();
$this->session_addDonorData();
$this->runDoPaymentFilters();
if ( !$this->filterActionIsProcess() ) {
Method render
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function render( $fileName, $data, $options = [] ) {
$defaultOptions = [
'flags' => LightnCandy::FLAG_ERROR_EXCEPTION | LightnCandy::FLAG_ADVARNAME,
];
if ( isset( $options['flags'] ) ) {
Method canBypassMinFraud
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function canBypassMinFraud() {
// if the data bits data_hash and action are not set, we need to hit minFraud
$localdata = $this->gateway_adapter->getData_Unstaged_Escaped();
if ( !isset( $localdata['data_hash'] ) || !strlen(
$localdata['data_hash']
Method filter
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function filter() {
// see if we can bypass minFraud
if ( $this->canBypassMinFraud() ) {
return true;
}
Function exports
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function ( grunt ) {
var conf = grunt.file.readJSON( 'extension.json' );
grunt.loadNpmTasks( 'grunt-banana-checker' );
grunt.loadNpmTasks( 'grunt-eslint' );
grunt.loadNpmTasks( 'grunt-stylelint' );
Function postMonthlyConvertDonate
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
mc.postMonthlyConvertDonate = function ( amount, declineMonthlyConvert ) {
var sendData = mc.getSendData( amount );
if ( declineMonthlyConvert ) {
sendData.declineMonthlyConvert = declineMonthlyConvert;
}
Method showMonthlyConvert
has 30 lines of code (exceeds 25 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
Function splitEmail
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
splitEmail: function(email) {
var parts = email.trim().split('@');
if (parts.length < 2) {
return false;
Method filter
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function filter( $filterListGlobal ) {
$functions = $this->gateway_adapter->getGlobal( $filterListGlobal );
if (
!$this->gateway_adapter->getGlobal( 'EnableFunctionsFilter' ) ||
Method executeRecurUpgrade
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function executeRecurUpgrade( $params ) {
$logger = self::getLogger();
$donorData = WmfFramework::getSessionValue( self::DONOR_DATA );
if ( !isset( $donorData['contribution_recur_id'] ) ) {
$this->renderError( $params );
Method addGatewaySpecificResources
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function addGatewaySpecificResources( $out ): void {
$script = $this->adapter->getAccountConfig( 'Script' );
$css = $this->adapter->getAccountConfig( 'Css' );
if ( $this->adapter->getPaymentMethod() == 'google' ) {
$googleScript = $this->adapter->getAccountConfig( 'GoogleScript' );
Method doPayment
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function doPayment() {
$this->setValidationAction( ValidationAction::PROCESS, true );
$this->logger->debug( 'Running onGatewayReady filters' );
Gateway_Extras_CustomFilters::onGatewayReady( $this );
if ( $this->getValidationAction() != ValidationAction::PROCESS ) {
Method getForm
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getForm() {
$options = [
'helpers' => [
'l10n' => 'EmailForm::l10n',
'dateFormatter' => 'EmailForm::dateFormatter',
Function addCardFieldEvents
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function addCardFieldEvents() {
cardField.addEventListener( 'change', function ( event ) {
cardFieldError = !!event.error;
if ( event.error ) {
$( '#cardNumberErrorMsg' ).text( mw.msg( 'donate_interface-error-msg-unsupported-card-entered' ) );