detain/myadmin-maxmind-plugin

View on GitHub

Showing 14 of 96 total issues

File female_names.inc.php has 999 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

    $female_names = [
    'mary',
    'patricia',
Severity: Major
Found in src/female_names.inc.php - About 2 days to fix

    Function update_maxmind_noaccount has a Cognitive Complexity of 82 (exceeds 5 allowed). Consider refactoring.
    Open

    function update_maxmind_noaccount($data)
    {
        require_once __DIR__.'/../../../minfraud/http/src/CreditCardFraudDetection.php';
        //require_once ('include/accounts/maxmind/CreditCardFraudDetection.php');
        //myadmin_log('maxmind', 'debug', "update_maxmind_noaccount Called", __LINE__, __FILE__);
    Severity: Minor
    Found in src/maxmind.inc.php - About 1 day 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 update_maxmind has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
    Open

    function update_maxmind($custid, $ip = false, $ccIdx = false)
    {
        $custid = (int)$custid;
        $good = true;
        $new_data = [];
    Severity: Minor
    Found in src/maxmind.inc.php - About 1 day 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

    Method update_maxmind has 173 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function update_maxmind($custid, $ip = false, $ccIdx = false)
    {
        $custid = (int)$custid;
        $good = true;
        $new_data = [];
    Severity: Major
    Found in src/maxmind.inc.php - About 6 hrs to fix

      File maxmind.inc.php has 386 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
       * MaxMind Fraud Stuff
       *
       * API Downloaded @ http://www.maxmind.com/download/ccfd/
      Severity: Minor
      Found in src/maxmind.inc.php - About 5 hrs to fix

        Method update_maxmind_noaccount has 113 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function update_maxmind_noaccount($data)
        {
            require_once __DIR__.'/../../../minfraud/http/src/CreditCardFraudDetection.php';
            //require_once ('include/accounts/maxmind/CreditCardFraudDetection.php');
            //myadmin_log('maxmind', 'debug', "update_maxmind_noaccount Called", __LINE__, __FILE__);
        Severity: Major
        Found in src/maxmind.inc.php - About 4 hrs to fix

          Method maxmind_lookup has 90 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function maxmind_lookup($customer, $ip = false)
          {
              $mf = new MinFraud(MAXMIND_USER_ID, MAXMIND_LICENSE_KEY);
              $data = $GLOBALS['tf']->accounts->read($customer);
              $request = $mf->withDevice([
          Severity: Major
          Found in src/maxmind_lookup.php - About 3 hrs to fix

            Method get_maxmind_field_descriptions has 84 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function get_maxmind_field_descriptions()
            {
                $fields = [
                    'distance' => 'Distance from IP address location to billing location in kilometers (large distance = higher risk).',
                    'countryMatch' => 'Whether country of IP address matches billing address country (mismatch = higher risk).',
            Severity: Major
            Found in src/maxmind.inc.php - About 3 hrs to fix

              Method view_maxmind has 59 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function view_maxmind()
                  {
                      require_once __DIR__.'/maxmind.inc.php'; // This handles fraud protection
                      page_title('MaxMind Credit Fraud Output');
                      function_requirements('has_acl');
              Severity: Major
              Found in src/view_maxmind.php - About 2 hrs to fix

                Method maxmind_compare has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function maxmind_compare()
                    {
                        function_requirements('has_acl');
                        if ($GLOBALS['tf']->ima != 'admin' || !has_acl('view_customer')) {
                            dialog('Not admin', 'Not Admin or you lack the permissions to view this page.');
                Severity: Major
                Found in src/maxmind_compare.php - About 2 hrs to fix

                  Function maxmind_compare has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                      function maxmind_compare()
                      {
                          function_requirements('has_acl');
                          if ($GLOBALS['tf']->ima != 'admin' || !has_acl('view_customer')) {
                              dialog('Not admin', 'Not Admin or you lack the permissions to view this page.');
                  Severity: Minor
                  Found in src/maxmind_compare.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 maxmind_lookup has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function maxmind_lookup($customer, $ip = false)
                  {
                      $mf = new MinFraud(MAXMIND_USER_ID, MAXMIND_LICENSE_KEY);
                      $data = $GLOBALS['tf']->accounts->read($customer);
                      $request = $mf->withDevice([
                  Severity: Minor
                  Found in src/maxmind_lookup.php - About 45 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

                  Consider simplifying this complex logical expression.
                  Open

                      if ((MAXMIND_CARDER_LOCK == true && isset($response['carderEmail']) && $response['carderEmail'] == 'Yes') || (isset($response['score']) && $response['score'] >= MAXMIND_SCORE_LOCK) || $response['riskScore'] >= MAXMIND_RISKSCORE_LOCK) {
                          $db->query("select * from invoices where invoices_type=1 and invoices_paid=1 and invoices_custid={$custid} and invoices_date <= date_sub(now(), INTERVAL 1 DAY) limit 1", __LINE__, __FILE__);
                          if ($db->num_rows() == 0) {
                              myadmin_log('maxmind', 'warning', "update_maxmind({$custid}, {$ip}) Carder Email Or High Score From Customer {$custid} (".(isset($response['score']) ? 'Score: '.$response['score'] : '')." RiskScore {$response['riskScore']}), Disabling Account", __LINE__, __FILE__);
                              function_requirements('disable_account');
                  Severity: Major
                  Found in src/maxmind.inc.php - About 40 mins to fix

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

                        function view_maxmind()
                        {
                            require_once __DIR__.'/maxmind.inc.php'; // This handles fraud protection
                            page_title('MaxMind Credit Fraud Output');
                            function_requirements('has_acl');
                    Severity: Minor
                    Found in src/view_maxmind.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