wikimedia/mediawiki-extensions-DonationInterface

View on GitHub
extras/custom_filters/filters/minfraud/minfraud.body.php

Summary

Maintainability
C
1 day
Test Coverage

File minfraud.body.php has 273 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Wikimedia Foundation
 *
 * LICENSE
Severity: Minor
Found in extras/custom_filters/filters/minfraud/minfraud.body.php - About 2 hrs to fix

    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']
    Severity: Minor
    Found in extras/custom_filters/filters/minfraud/minfraud.body.php - About 1 hr to fix

      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;
              }
      Severity: Minor
      Found in extras/custom_filters/filters/minfraud/minfraud.body.php - About 1 hr to fix

        Function withExtraFields has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function withExtraFields( $data, $query ) {
                foreach ( self::$extraFieldsMap as $section => $fields ) {
                    foreach ( $fields as $ourName => $theirName ) {
                        if ( in_array( $ourName, $this->enabledExtraFields ) ) {
                            if ( !empty( $data[$ourName] ) ) {
        Severity: Minor
        Found in extras/custom_filters/filters/minfraud/minfraud.body.php - About 1 hr 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 healthCheck has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function healthCheck( Score $response ) {
                global $wgEmergencyContact;
        
                if ( isset( $response->queriesRemaining ) ) {
                    $queries = intval( $response->queriesRemaining );
        Severity: Minor
        Found in extras/custom_filters/filters/minfraud/minfraud.body.php - About 1 hr 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 canBypassMinFraud has a Cognitive Complexity of 9 (exceeds 5 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']
        Severity: Minor
        Found in extras/custom_filters/filters/minfraud/minfraud.body.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

        There are no issues that match your filters.

        Category
        Status