mambax7/xnewsletter

View on GitHub

Showing 379 of 379 total issues

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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            if (true === Request::getBool('ok', false, 'POST')) {
                if (!$GLOBALS['xoopsSecurity']->check()) {
                    redirect_header($currentFile, 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
                }
                if ($helper->getHandler('Letter')->delete($letterObj)) {
    Severity: Major
    Found in letter.php and 1 other location - About 1 day to fix
    admin/letter.php on lines 415..436

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 305.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            if (true === Request::getBool('ok', false, 'POST')) {
                if (!$GLOBALS['xoopsSecurity']->check()) {
                    redirect_header($currentFile, 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
                }
                if ($helper->getHandler('Letter')->delete($letterObj)) {
    Severity: Major
    Found in admin/letter.php and 1 other location - About 1 day to fix
    letter.php on lines 620..641

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 305.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function xnewsletter_setPost has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
    Open

    function xnewsletter_setPost($contentObj, $sets)
    {
        if (!is_object($contentObj)) {
            return false;
        }
    Severity: Minor
    Found in include/functions.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

    File class.smtp.php has 558 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * PHPMailer RFC821 SMTP email transport class.
     * PHP Version 5
     * @package   PHPMailer
    Severity: Major
    Found in include/phpmailer/class.smtp.php - About 1 day to fix

      Function wrapText has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
      Open

          public function wrapText($message, $length, $qp_mode = false)
          {
              if ($qp_mode) {
                  $soft_break = sprintf(' =%s', $this->LE);
              } else {
      Severity: Minor
      Found in include/phpmailer/class.phpmailer.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

      File functions.php has 540 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
       * ****************************************************************************
       *  - A Project by Developers TEAM For Xoops - ( https://xoops.org )
       * ****************************************************************************
      Severity: Major
      Found in include/functions.php - About 1 day to fix

        Function processMailbox has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
        Open

            public function processMailbox($max = false)
            {
                if (empty($this->action_function) || !function_exists($this->action_function)) {
                    $this->error_msg = 'Action function not found!';
                    $this->output();
        Severity: Minor
        Found in include/phpmailer_bmh/class.phpmailer-bmh.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 tln_getnxtag has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
        Open

        function tln_getnxtag($body, $offset)
        {
            if ($offset > mb_strlen($body)) {
                return false;
            }
        Severity: Minor
        Found in include/phpmailer/extras/htmlfilter.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 bmhBodyRules has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
        Open

        function bmhBodyRules($body, /** @noinspection PhpUnusedParameterInspection */ $structure, $debug_mode = false): array
        {
            global $rule_categories;
            global $bmh_newline;
        
        
        Severity: Minor
        Found in include/phpmailer_bmh/phpmailer-bmh_rules.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 tln_fixatts has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
        Open

        function tln_fixatts(
            $tagname,
            $attary,
            $rm_attnames,
            $bad_attvals,
        Severity: Minor
        Found in include/phpmailer/extras/htmlfilter.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

        File letter.php has 517 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /**
         * ****************************************************************************
         *  - A Project by Developers TEAM For Xoops - ( https://xoops.org )
         * ****************************************************************************
        Severity: Major
        Found in letter.php - About 1 day to fix

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                  if (true === \Xmf\Request::getBool('ok', false, 'POST')) {
                      $result = $xoopsDB->queryF("TRUNCATE TABLE `{$xoopsDB->prefix('xnewsletter_import')}`");
                      $result = $xoopsDB->queryF("REPAIR TABLE `{$xoopsDB->prefix('xnewsletter_import')}`");
                      $result = $xoopsDB->queryF("OPTIMIZE TABLE `{$xoopsDB->prefix('xnewsletter_import')}`");
                      $result = $xoopsDB->queryF("ALTER TABLE `{$xoopsDB->prefix('xnewsletter_import')}` AUTO_INCREMENT =1");
          Severity: Major
          Found in admin/maintenance.php and 1 other location - About 1 day to fix
          admin/maintenance.php on lines 265..285

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 252.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                  if (true === Request::getBool('ok', false, 'POST')) {
                      $result = $xoopsDB->queryF("TRUNCATE TABLE `{$xoopsDB->prefix('xnewsletter_protocol')}`");
                      $result = $xoopsDB->queryF("REPAIR TABLE `{$xoopsDB->prefix('xnewsletter_protocol')}`");
                      $result = $xoopsDB->queryF("OPTIMIZE TABLE `{$xoopsDB->prefix('xnewsletter_protocol')}`");
                      $result = $xoopsDB->queryF("ALTER TABLE `{$xoopsDB->prefix('xnewsletter_protocol')}` AUTO_INCREMENT =1");
          Severity: Major
          Found in admin/maintenance.php and 1 other location - About 1 day to fix
          admin/maintenance.php on lines 174..194

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 252.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Function attachAll has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function attachAll($disposition_type, $boundary)
              {
                  // Return text of body
                  $mime    = [];
                  $cidUniq = [];
          Severity: Minor
          Found in include/phpmailer/class.phpmailer.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

          File admin.php has 479 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          /**
           * ****************************************************************************
           *  XNEWSLETTER - MODULE FOR XOOPS
           *  Copyright (c) 2007 - 2012
          Severity: Minor
          Found in language/english/admin.php - About 7 hrs to fix

            File admin.php has 478 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php   
            /**
             * ****************************************************************************
             *  XNEWSLETTER - MODULE FOR XOOPS
             *  Copyright (c) 2007 - 2012
            Severity: Minor
            Found in language/german/admin.php - About 7 hrs to fix

              File maintenance.php has 475 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              /**
               * ****************************************************************************
               *  - A Project by Developers TEAM For Xoops - ( https://xoops.org )
               * ****************************************************************************
              Severity: Minor
              Found in admin/maintenance.php - About 7 hrs 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

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                <?php
                /**
                 * ****************************************************************************
                 *  - A Project by Developers TEAM For Xoops - ( http://www.xoops.org )
                 * ****************************************************************************
                Severity: Major
                Found in language/german/common.php and 1 other location - About 7 hrs to fix
                language/english/common.php on lines 1..45

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 225.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Severity
                Category
                Status
                Source
                Language