XoopsModules25x/latestnews

View on GitHub

Showing 60 of 60 total issues

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

<?php
/**
* Translation of latestnews for Persian users by stranger <pesian_stranger@users.sourceforge.net>
*/
define ("_MB_LATESTNEWS_INF","بلوک آخرین اخبار");
Severity: Major
Found in language/persian/blocks.php and 2 other locations - About 2 days to fix
language/english/blocks.php on lines 1..45
language/portuguesebr/blocks.php on lines 1..54

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

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 3 locations. Consider refactoring.
Open

<?php
/**
 * @Language: Portuguesebr
 * @Translators: GibaPhp /
 */
Severity: Major
Found in language/portuguesebr/blocks.php and 2 other locations - About 2 days to fix
language/english/blocks.php on lines 1..45
language/persian/blocks.php on lines 1..48

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

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 3 locations. Consider refactoring.
Open

<?php
define("_MB_LATESTNEWS_INF","Last News Block");
define("_MB_LATESTNEWS_POSTER", "Posted by ");
define("_MB_SP", " : ");
define("_MB_LDCOUNTER", "Read");
Severity: Major
Found in language/english/blocks.php and 2 other locations - About 2 days to fix
language/persian/blocks.php on lines 1..48
language/portuguesebr/blocks.php on lines 1..54

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

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 ($op == 'clone') {
    xoops_cp_header();
    $myblock = new XoopsBlock($bid);

    $db =& XoopsDatabaseFactory::getDatabaseConnection();
Severity: Major
Found in include/blocksadmin.inc.php and 1 other location - About 2 days to fix
include/blocksadmin.inc.php on lines 254..277

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

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 ($op == 'edit') {

  xoops_cp_header();
  // edit_block($bid); GIJ imported from blocksadmin.php
        $myblock = new XoopsBlock($bid);
Severity: Major
Found in include/blocksadmin.inc.php and 1 other location - About 2 days to fix
include/blocksadmin.inc.php on lines 279..298

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

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

function block_latestnews_show($options)
{
    global $xoopsTpl, $xoopsUser, $xoopsConfig, $pathIcon16, $xoopsModule;
    include_once XOOPS_ROOT_PATH . '/modules/latestnews/include/functions.php';

Severity: Minor
Found in blocks/latestnews.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 blocksadmin.php has 522 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Module: XoopsTube
 *
 * You may not change or alter any portion of this comment or credits
Severity: Major
Found in admin/blocksadmin.php - About 1 day to fix

    Method block_latestnews_show has 206 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function block_latestnews_show($options)
    {
        global $xoopsTpl, $xoopsUser, $xoopsConfig, $pathIcon16, $xoopsModule;
        include_once XOOPS_ROOT_PATH . '/modules/latestnews/include/functions.php';
    
    
    Severity: Major
    Found in blocks/latestnews.php - About 1 day to fix

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

          function check( $post = true , $area = '' , $allow_repost = true )
          {
              global $xoopsModule ;
      
              $this->_errors = array() ;
      Severity: Minor
      Found in include/gtickets.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

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

          function listBlocks()
          {
              global $xoopsUser, $xoopsConfig, $xoopsModule, $pathIcon16;
              include_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
              $db =& XoopsDatabaseFactory::getDatabaseConnection();
      Severity: Major
      Found in admin/blocksadmin.php - About 6 hrs to fix

        Function listBlocks has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
        Open

            function listBlocks()
            {
                global $xoopsUser, $xoopsConfig, $xoopsModule, $pathIcon16;
                include_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
                $db =& XoopsDatabaseFactory::getDatabaseConnection();
        Severity: Minor
        Found in admin/blocksadmin.php - About 6 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

        Function prepare2show has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
        Open

            function prepare2show($filescount)
            {
                include_once XOOPS_ROOT_PATH.'/modules/news/include/functions.php';
                global $xoopsUser, $xoopsConfig, $xoopsModuleConfig;
                $myts =& MyTextSanitizer::getInstance();
        Severity: Minor
        Found in class/class.latestnews.php - About 5 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

        Function myblocksadmin_update_block has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
        Open

            function myblocksadmin_update_block($bid, $bside, $bweight, $bvisible, $btitle, $bcontent, $bctype, $bcachetime, $bmodule, $options=array())
            {
                global $xoopsConfig;
        
                $myblock = new XoopsBlock($bid);
        Severity: Minor
        Found in include/blocksadmin.inc.php - About 5 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

        Function getAllPublished has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
        Open

            static function getAllPublished($limit=0, $selected_stories=true, $start=0, $checkRight=false, $topic=0, $ihome=0, $asobject=true, $order = 'published', $topic_frontpage=false)
            {
                $db =& XoopsDatabaseFactory::getDatabaseConnection();
                $myts =& MyTextSanitizer::getInstance();
        
        
        Severity: Minor
        Found in class/class.latestnews.php - About 5 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 blocksadmin.inc.php has 366 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        // $Id: blocksadmin.inc.php 12106 2013-09-29 10:23:10Z beckmi $
        //  ------------------------------------------------------------------------ //
        //                XOOPS - PHP Content Management System                      //
        //                    Copyright (c) 2000 XOOPS.org                           //
        Severity: Minor
        Found in include/blocksadmin.inc.php - About 4 hrs to fix

          Method prepare2show has 104 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function prepare2show($filescount)
              {
                  include_once XOOPS_ROOT_PATH.'/modules/news/include/functions.php';
                  global $xoopsUser, $xoopsConfig, $xoopsModuleConfig;
                  $myts =& MyTextSanitizer::getInstance();
          Severity: Major
          Found in class/class.latestnews.php - About 4 hrs to fix

            Method b_latestnews_edit has 99 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function b_latestnews_edit($options)
            {
                global $xoopsDB;
                include_once XOOPS_ROOT_PATH . '/modules/latestnews/include/functions.php';
                include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newstopic.php';
            Severity: Major
            Found in blocks/latestnews.php - About 3 hrs to fix

              File latestnews.php has 312 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              // ######################################################################
              // #                                                                    #
              // # Latest News block by Mowaffak ( www.arabxoops.com )                #
              // # based on Last Articles Block by Pete Glanz (www.glanz.ru)          #
              Severity: Minor
              Found in blocks/latestnews.php - About 3 hrs to fix

                Function isBlockCloned has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                Open

                    function isBlockCloned($bid, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options)
                    {
                        global $xoopsUser, $xoopsConfig;
                        if (file_exists(
                            XOOPS_ROOT_PATH . "/modules/system/language/" . $xoopsConfig['language'] . "/admin/blocksadmin.php"
                Severity: Minor
                Found in admin/blocksadmin.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

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

                        if (file_exists(
                            XOOPS_ROOT_PATH . "/modules/system/language/" . $xoopsConfig['language'] . "/admin/blocksadmin.php"
                        )
                        ) {
                            include_once(XOOPS_ROOT_PATH . "/modules/system/language/" . $xoopsConfig['language'] . "/admin.php");
                Severity: Major
                Found in admin/blocksadmin.php and 1 other location - About 3 hrs to fix
                admin/blocksadmin.php on lines 416..429

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

                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