mambax7/xnewsletter

View on GitHub
include/task.inc.php

Summary

Maintainability
F
5 days
Test Coverage

Function xnewsletter_executeTasks has a Cognitive Complexity of 99 (exceeds 5 allowed). Consider refactoring.
Open

function xnewsletter_executeTasks($xn_send_in_packages, $letter_id = 0, $cron = 0)
{
    require_once XOOPS_ROOT_PATH . '/modules/xnewsletter/include/functions.php';
//    require_once XNEWSLETTER_ROOT_PATH . '/class/class.xnewslettermailer.php';

Severity: Minor
Found in include/task.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 xnewsletter_executeTasks has 303 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function xnewsletter_executeTasks($xn_send_in_packages, $letter_id = 0, $cron = 0)
{
    require_once XOOPS_ROOT_PATH . '/modules/xnewsletter/include/functions.php';
//    require_once XNEWSLETTER_ROOT_PATH . '/class/class.xnewslettermailer.php';

Severity: Major
Found in include/task.inc.php - About 1 day to fix

    Function xnewsletter_createTasks has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
    Open

    function xnewsletter_createTasks($op, $letter_id, $xn_send_in_packages, $xn_send_in_packages_time)
    {
        global $xoopsUser, $xoopsDB;
        $helper = Xnewsletter\Helper::getInstance();
    
    
    Severity: Minor
    Found in include/task.inc.php - About 7 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

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

    <?php
    /**
     * ****************************************************************************
     *  - A Project by Developers TEAM For Xoops - ( https://xoops.org )
     * ****************************************************************************
    Severity: Minor
    Found in include/task.inc.php - About 5 hrs to fix

      Method xnewsletter_createTasks has 96 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function xnewsletter_createTasks($op, $letter_id, $xn_send_in_packages, $xn_send_in_packages_time)
      {
          global $xoopsUser, $xoopsDB;
          $helper = Xnewsletter\Helper::getInstance();
      
      
      Severity: Major
      Found in include/task.inc.php - About 3 hrs to fix

        Avoid too many return statements within this method.
        Open

                    return null;
        Severity: Major
        Found in include/task.inc.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

              return $protocol_status;
          Severity: Major
          Found in include/task.inc.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return _MA_XNEWSLETTER_ACCOUNTS_NONEAVAIL;
            Severity: Major
            Found in include/task.inc.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                                  return $task_subscrs->getErrors();
              Severity: Major
              Found in include/task.inc.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return $task_letters->getErrors();
                Severity: Major
                Found in include/task.inc.php - About 30 mins to fix

                  There are no issues that match your filters.

                  Category
                  Status