detain/myadmin-fraudrecord-plugin

View on GitHub

Showing 29 of 29 total issues

Function update_fraudrecord has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

function update_fraudrecord($custid, $module = 'default', $ip = false)
{
    //myadmin_log('accounts', 'info', "update_fraudrecord($custid, $module) Called", __LINE__, __FILE__);
    $module = get_module_name($module);
    $db = get_module_db($module);
Severity: Minor
Found in src/fraudrecord.inc.php - About 3 hrs 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_fraudrecord has 70 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function update_fraudrecord($custid, $module = 'default', $ip = false)
{
    //myadmin_log('accounts', 'info', "update_fraudrecord($custid, $module) Called", __LINE__, __FILE__);
    $module = get_module_name($module);
    $db = get_module_db($module);
Severity: Major
Found in src/fraudrecord.inc.php - About 2 hrs to fix

    Method update_fraudrecord_noaccount has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function update_fraudrecord_noaccount($data)
    {
        //myadmin_log('accounts', 'info', "update_fraudrecord_noaccount Called", __LINE__, __FILE__);
        $h = [
            '_action' => 'query',
    Severity: Minor
    Found in src/fraudrecord.inc.php - About 1 hr to fix

      Method fraudrecord_report has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function fraudrecord_report($custid, $module, $type, $text, $value)
      {
          //myadmin_log('accounts', 'info', "fraudrecord_report($custid, $module, $type, $text, $value) Called", __LINE__, __FILE__);
          $module = get_module_name($module);
          $db = get_module_db($module);
      Severity: Minor
      Found in src/fraudrecord.inc.php - About 1 hr to fix

        Avoid using undefined variables such as '$new_data' which will lead to PHP notices.
        Open

                $new_data['country'] = 'US';
        Severity: Minor
        Found in src/fraudrecord.inc.php by phpmd

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Avoid using undefined variables such as '$custid' which will lead to PHP notices.
        Open

                $smarty->assign('account_id', $custid);
        Severity: Minor
        Found in src/fraudrecord.inc.php by phpmd

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Avoid using undefined variables such as '$custid' which will lead to PHP notices.
        Open

                $smarty->assign('account_lid', $GLOBALS['tf']->accounts->cross_reference($custid));
        Severity: Minor
        Found in src/fraudrecord.inc.php by phpmd

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Avoid using undefined variables such as '$custid' which will lead to PHP notices.
        Open

                myadmin_log('accounts', 'info', "update_fraudrecord({$custid}, {$module}) fraudrecord Output: ".str_replace("\n", '', var_export($matches, true)), __LINE__, __FILE__);
        Severity: Minor
        Found in src/fraudrecord.inc.php by phpmd

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Avoid using undefined variables such as '$module' which will lead to PHP notices.
        Open

                myadmin_log('accounts', 'info', "update_fraudrecord({$custid}, {$module}) fraudrecord Output: ".str_replace("\n", '', var_export($matches, true)), __LINE__, __FILE__);
        Severity: Minor
        Found in src/fraudrecord.inc.php by phpmd

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Function update_fraudrecord_noaccount has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        function update_fraudrecord_noaccount($data)
        {
            //myadmin_log('accounts', 'info', "update_fraudrecord_noaccount Called", __LINE__, __FILE__);
            $h = [
                '_action' => 'query',
        Severity: Minor
        Found in src/fraudrecord.inc.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

        Method fraudrecord_report has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        function fraudrecord_report($custid, $module, $type, $text, $value)
        Severity: Minor
        Found in src/fraudrecord.inc.php - About 35 mins to fix

          Missing class import via use statement (line '147', column '23').
          Open

                  $smarty = new TFSmarty();
          Severity: Minor
          Found in src/fraudrecord.inc.php by phpmd

          MissingImport

          Since: 2.7.0

          Importing all external classes in a file through use statements makes them clearly visible.

          Example

          function make() {
              return new \stdClass();
          }

          Source http://phpmd.org/rules/cleancode.html#MissingImport

          Missing class import via use statement (line '221', column '23').
          Open

                  $smarty = new TFSmarty();
          Severity: Minor
          Found in src/fraudrecord.inc.php by phpmd

          MissingImport

          Since: 2.7.0

          Importing all external classes in a file through use statements makes them clearly visible.

          Example

          function make() {
              return new \stdClass();
          }

          Source http://phpmd.org/rules/cleancode.html#MissingImport

          Missing class import via use statement (line '168', column '18').
          Open

                      (new \MyAdmin\Mail())->adminMail($subject, $email, false, 'admin/fraud.tpl');
          Severity: Minor
          Found in src/fraudrecord.inc.php by phpmd

          MissingImport

          Since: 2.7.0

          Importing all external classes in a file through use statements makes them clearly visible.

          Example

          function make() {
              return new \stdClass();
          }

          Source http://phpmd.org/rules/cleancode.html#MissingImport

          Avoid unused local variables such as '$menu'.
          Open

                  $menu = $event->getSubject();
          Severity: Minor
          Found in src/Plugin.php by phpmd

          UnusedLocalVariable

          Since: 0.2

          Detects when a local variable is declared and/or assigned, but not used.

          Example

          class Foo {
              public function doSomething()
              {
                  $i = 5; // Unused
              }
          }

          Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

          Avoid unused local variables such as '$db'.
          Open

              $db = get_module_db($module);
          Severity: Minor
          Found in src/fraudrecord.inc.php by phpmd

          UnusedLocalVariable

          Since: 0.2

          Detects when a local variable is declared and/or assigned, but not used.

          Example

          class Foo {
              public function doSomething()
              {
                  $i = 5; // Unused
              }
          }

          Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

          Avoid unused local variables such as '$email'.
          Open

                  $email = $smarty->fetch('email/admin/fraud.tpl');
          Severity: Minor
          Found in src/fraudrecord.inc.php by phpmd

          UnusedLocalVariable

          Since: 0.2

          Detects when a local variable is declared and/or assigned, but not used.

          Example

          class Foo {
              public function doSomething()
              {
                  $i = 5; // Unused
              }
          }

          Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

          Avoid unused local variables such as '$db'.
          Open

              $db = get_module_db($module);
          Severity: Minor
          Found in src/fraudrecord.inc.php by phpmd

          UnusedLocalVariable

          Since: 0.2

          Detects when a local variable is declared and/or assigned, but not used.

          Example

          class Foo {
              public function doSomething()
              {
                  $i = 5; // Unused
              }
          }

          Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

          Avoid unused local variables such as '$lid'.
          Open

              $lid = $data['account_lid'];
          Severity: Minor
          Found in src/fraudrecord.inc.php by phpmd

          UnusedLocalVariable

          Since: 0.2

          Detects when a local variable is declared and/or assigned, but not used.

          Example

          class Foo {
              public function doSomething()
              {
                  $i = 5; // Unused
              }
          }

          Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

          Avoid unused local variables such as '$module'.
          Open

                  myadmin_log('accounts', 'info', "update_fraudrecord({$custid}, {$module}) fraudrecord Output: ".str_replace("\n", '', var_export($matches, true)), __LINE__, __FILE__);
          Severity: Minor
          Found in src/fraudrecord.inc.php by phpmd

          UnusedLocalVariable

          Since: 0.2

          Detects when a local variable is declared and/or assigned, but not used.

          Example

          class Foo {
              public function doSomething()
              {
                  $i = 5; // Unused
              }
          }

          Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

          Severity
          Category
          Status
          Source
          Language