XoopsModules25x/news

View on GitHub

Showing 305 of 305 total issues

Function b_news_top_show has a Cognitive Complexity of 286 (exceeds 5 allowed). Consider refactoring.
Open

function b_news_top_show($options)
{
    global $xoopsConfig;

    /** @var Helper $helper */
Severity: Minor
Found in blocks/news_top.php - About 5 days 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 index.php has 1679 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
//
// ------------------------------------------------------------------------ //
// XOOPS - PHP Content Management System                                    //
// Copyright (c) 2000-2020 XOOPS.org                                             //
Severity: Major
Found in admin/index.php - About 4 days to fix

    File NewsStory.php has 1239 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace XoopsModules\News;
    
    /*
    Severity: Major
    Found in class/NewsStory.php - About 3 days to fix

      Method b_news_top_show has 478 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function b_news_top_show($options)
      {
          global $xoopsConfig;
      
          /** @var Helper $helper */
      Severity: Major
      Found in blocks/news_top.php - About 2 days to fix

        Method topicsmanager has 410 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function topicsmanager()
        {
            global $xoopsDB, $xoopsConfig, $xoopsModule, $myts;
            require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
            xoops_cp_header();
        Severity: Major
        Found in admin/index.php - About 2 days to fix

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

              public static function getEditor($helper = null, $options = null)
              {
                  /** @var News\Helper $helper */
                  if (null === $options) {
                      $options           = [];
          Severity: Major
          Found in class/Utility.php and 1 other location - About 1 day to fix
          class/Common/SysUtility.php on lines 159..191

          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 320.

          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

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

              public static function getEditor($helper = null, $options = null)
              {
                  /** @var Helper $helper */
                  if (null === $options) {
                      $options           = [];
          Severity: Major
          Found in class/Common/SysUtility.php and 1 other location - About 1 day to fix
          class/Utility.php on lines 268..300

          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 320.

          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 store has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring.
          Open

              public function store()
              {
                  $myts   = \MyTextSanitizer::getInstance();
                  $title  = '';
                  $imgurl = '';
          Severity: Minor
          Found in class/XoopsTopic.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 xoops_version.php has 628 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          /*
           * You may not change or alter any portion of this comment or credits
           * of supporting developers from this source code or any supporting source code
           * which is considered copyrighted (c) material of the original comment or credit authors.
          Severity: Major
          Found in xoops_version.php - About 1 day to fix

            Function store has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring.
            Open

                public function store()
                {
                    $myts              = \MyTextSanitizer::getInstance();
                    $title             = '';
                    $imgurl            = '';
            Severity: Minor
            Found in class/NewsTopic.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 news_top.php has 594 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            /*
             * You may not change or alter any portion of this comment or credits
             * of supporting developers from this source code or any supporting source code
             * which is considered copyrighted (c) material of the original comment or credit authors.
            Severity: Major
            Found in blocks/news_top.php - About 1 day to fix

              File Utility.php has 552 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              
              namespace XoopsModules\News;
              
              use WideImage\WideImage;
              Severity: Major
              Found in class/Utility.php - About 1 day to fix

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

                if ($approveprivilege) {
                    if (is_object($xoopsUser) && $xoopsUser->isAdmin($xoopsModule->getVar('mid'))) {
                        $approve = 1;
                    }
                    $approve_checkbox = new \XoopsFormCheckBox('', 'approve', $approve);
                Severity: Major
                Found in include/storyform.inc.php and 1 other location - About 1 day to fix
                include/storyform.original.php on lines 170..191

                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 262.

                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

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

                if ($approveprivilege) {
                    if (is_object($xoopsUser) && $xoopsUser->isAdmin($xoopsModule->getVar('mid'))) {
                        $approve = 1;
                    }
                    $approve_checkbox = new \XoopsFormCheckBox('', 'approve', $approve);
                Severity: Major
                Found in include/storyform.original.php and 1 other location - About 1 day to fix
                include/storyform.inc.php on lines 172..193

                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 262.

                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

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

                <?php
                /*
                 * You may not change or alter any portion of this comment or credits
                 * of supporting developers from this source code or any supporting source code
                 * which is considered copyrighted (c) material of the original comment or credit authors.
                Severity: Major
                Found in include/functions.php - About 1 day to fix

                  Method listBlocks has 213 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function listBlocks()
                      {
                          global $xoopsModule, $pathIcon16;
                          require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
                          $moduleDirName      = basename(dirname(__DIR__));
                  Severity: Major
                  Found in admin/blocksadmin.php - About 1 day to fix

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

                        public static function truncateHtml($text, $length = 100, $ending = '...', $exact = false, $considerHtml = true)
                        {
                            if ($considerHtml) {
                                // if the plain text is shorter than the maximum length, return the whole text
                                if (mb_strlen(\preg_replace('/<.*?' . '>/', '', $text)) <= $length) {
                    Severity: Minor
                    Found in class/Common/SysUtility.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 xoops_module_update_news has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function xoops_module_update_news(\XoopsModule $module, $previousVersion = null)
                    {
                        $moduleDirName      = basename(dirname(__DIR__));
                        $moduleDirNameUpper = mb_strtoupper($moduleDirName);
                    
                    
                    Severity: Minor
                    Found in include/onupdate.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 submit.php has 499 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php
                    /*
                     * You may not change or alter any portion of this comment or credits
                     * of supporting developers from this source code or any supporting source code
                     * which is considered copyrighted (c) material of the original comment or credit authors.
                    Severity: Minor
                    Found in submit.php - About 1 day to fix

                      File NewsTopic.php has 474 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      <?php
                      
                      namespace XoopsModules\News;
                      
                      /*
                      Severity: Minor
                      Found in class/NewsTopic.php - About 7 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language