XoopsModules25x/news

View on GitHub

Showing 310 of 310 total issues

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

function b_news_topics_moderate()
{
    // require_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php';

    /** @var Helper $helper */
Severity: Minor
Found in blocks/news_moderate.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 launchExport has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

function launchExport(): void
{
    xoops_cp_header();
    $adminObject = Admin::getInstance();
    $adminObject->displayNavigation('index.php?op=export');
Severity: Minor
Found in admin/index.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 xoops_module_pre_install_news has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

function xoops_module_pre_install_news(\XoopsModule $module)
{
    // Check if this XOOPS version is supported
    $minSupportedVersion = explode('.', '2.5.0');
    $currentVersion      = explode('.', mb_substr(XOOPS_VERSION, 6));
Severity: Minor
Found in include/install_function.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 isBlockCloned has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function isBlockCloned(int $bid, string $bside, string $bweight, string $bvisible, string $bcachetime, ?array $bmodule, ?array $options, ?array $groups): void
    {
        \xoops_loadLanguage('admin', 'system');
        \xoops_loadLanguage('admin/blocksadmin', 'system');
        \xoops_loadLanguage('admin/groups', 'system');
Severity: Minor
Found in class/Common/Blocksadmin.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 getWysiwygForm has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getWysiwygForm($caption, $name, $value = '', $width = '100%', $height = '400px', $supplemental = '')
    {
        $editor_option            = \mb_strtolower(static::getModuleOption('form_options'));
        $editor                   = false;
        $editor_configs           = [];
Severity: Minor
Found in class/Utility.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 getModuleOption has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getModuleOption($option, $repmodule = 'news')
    {
        global $xoopsModuleConfig, $xoopsModule;
        static $tbloptions = [];
        if (\is_array($tbloptions) && \array_key_exists($option, $tbloptions)) {
Severity: Minor
Found in class/Utility.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

Method createNewsletter has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function createNewsletter(): void
{
    require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
    xoops_cp_header();
    $adminObject = Admin::getInstance();
Severity: Minor
Found in admin/index.php - About 1 hr to fix

    Method cloneBlock has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function cloneBlock(int $bid): void
        {
            //require_once __DIR__ . '/admin_header.php';
            //        \xoops_cp_header();
    
    
    Severity: Minor
    Found in class/Common/Blocksadmin.php - About 1 hr to fix

      Method orderBlock has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function orderBlock(
              array $bid, array $oldtitle, array $oldside, array $oldweight, array $oldvisible, array $oldgroups, array $oldbcachetime, array $oldbmodule, array $title, array $weight, array $visible, array $side, array $bcachetime, array $groups, array $bmodule
          ): void {
              if (!$GLOBALS['xoopsSecurity']->check()) {
                  \redirect_header($_SERVER['SCRIPT_NAME'], 3, \implode('<br>', $GLOBALS['xoopsSecurity']->getErrors()));
      Severity: Minor
      Found in class/Common/Blocksadmin.php - About 1 hr to fix

        Method renderImageNav has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function renderImageNav($offset = 4)
            {
                if ($this->total < $this->perpage) {
                    return null;
                }
        Severity: Minor
        Found in class/PageNav.php - About 1 hr to fix

          Method editBlock has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function editBlock(int $bid): void
              {
                  //        require_once \dirname(__DIR__,2) . '/admin/admin_header.php';
                  //        \xoops_cp_header();
                  \xoops_loadLanguage('admin', 'system');
          Severity: Minor
          Found in class/Common/Blocksadmin.php - About 1 hr to fix

            Method uname has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function uname($uid = 0)
                {
                    global $xoopsConfig;
                    static $tblusers = [];
                    $option = -1;
            Severity: Minor
            Found in class/NewsStory.php - About 1 hr to fix

              Consider simplifying this complex logical expression.
              Open

                  if ($approveprivilege && 'edit' === $_GET['op']) {
                      $op      = 'edit';
                      $storyid = Request::getInt('storyid', 0, 'GET');
                  } elseif ($approveprivilege && 'delete' === $_GET['op']) {
                      $op      = 'delete';
              Severity: Critical
              Found in submit.php - About 1 hr to fix

                Method confirmBeforePrune has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function confirmBeforePrune(): void
                {
                    global $dateformat;
                    $story = new NewsStory();
                    xoops_cp_header();
                Severity: Minor
                Found in admin/index.php - About 1 hr to fix

                  Method news_tag_synchronization has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function news_tag_synchronization($mid): void
                  {
                      global $xoopsDB;
                      $itemHandler_keyName = 'storyid';
                      $itemHandler_table   = $xoopsDB->prefix('news_stories');
                  Severity: Minor
                  Found in class/plugins/plugin.tag.php - About 1 hr to fix

                    Method renderNav has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function renderNav($offset = 4)
                        {
                            $ret = '';
                            if ($this->total <= $this->perpage) {
                                return $ret;
                    Severity: Minor
                    Found in class/PageNav.php - About 1 hr to fix

                      Method exportNews has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function exportNews(): void
                      {
                          require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
                          xoops_cp_header();
                          $adminObject = Admin::getInstance();
                      Severity: Minor
                      Found in admin/index.php - About 1 hr to fix

                        Method getStoriesByIds has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function getStoriesByIds(
                                $ids,
                                $checkRight = true,
                                $asobject = true,
                                $order = 'published',
                        Severity: Minor
                        Found in class/NewsStory.php - About 1 hr to fix

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

                              public function topic_rssurl($format = 'S')
                              {
                                  $myts = \MyTextSanitizer::getInstance();
                                  switch ($format) {
                                      case 'S':
                          Severity: Major
                          Found in class/NewsTopic.php and 1 other location - About 1 hr to fix
                          class/NewsTopic.php on lines 507..524

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

                          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

                              public function topic_color($format = 'S')
                              {
                                  $myts = \MyTextSanitizer::getInstance();
                                  switch ($format) {
                                      case 'S':
                          Severity: Major
                          Found in class/NewsTopic.php and 1 other location - About 1 hr to fix
                          class/NewsTopic.php on lines 483..500

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

                          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