XoopsModules25x/latestnews

View on GitHub

Showing 60 of 60 total issues

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

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

Function draw_repost_form has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    function draw_repost_form( $area = '' )
    {
        // Notify which file is broken
        if ( headers_sent() ) {
            restore_error_handler() ;
Severity: Minor
Found in include/gtickets.php - About 2 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

    array(
         '0'       => _NOCACHE,
         '30'      => sprintf(_SECONDS, 30),
         '60'      => _MINUTE,
         '300'     => sprintf(_MINUTES, 5),
Severity: Major
Found in admin/blockform.php and 1 other location - About 2 hrs to fix
admin/blocksadmin.php on lines 88..100

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

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

        $cachetimes  = array(
            '0'       => _NOCACHE,
            '30'      => sprintf(_SECONDS, 30),
            '60'      => _MINUTE,
            '300'     => sprintf(_MINUTES, 5),
Severity: Major
Found in admin/blocksadmin.php and 1 other location - About 2 hrs to fix
admin/blockform.php on lines 101..113

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

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

Method isBlockCloned has 70 lines of code (exceeds 25 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: Major
Found in admin/blocksadmin.php - About 2 hrs to fix

    Method myblocksadmin_update_block has 64 lines of code (exceeds 25 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: Major
    Found in include/blocksadmin.inc.php - About 2 hrs to fix

      Function xtubeUpdateBlock has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          function xtubeUpdateBlock($bid, $btitle, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $boptions, $groups)
          {
              $myblock = new XoopsBlock($bid);
              $myblock->setVar('title', $btitle);
              $myblock->setVar('weight', $bweight);
      Severity: Minor
      Found in admin/blocksadmin.php - About 2 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

      function latestnews_mk_select($options, $number)
      {
          $slc   = "";
          if ($options[$number] == 1) {
              $slc = " checked='checked'";
      Severity: Major
      Found in include/functions.php and 1 other location - About 2 hrs to fix
      include/functions.php on lines 28..42

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

      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

      function latestnews_mk_chkbox($options, $number)
      {
          $chk   = "";
          if ($options[$number] == 1) {
              $chk = " checked='checked'";
      Severity: Major
      Found in include/functions.php and 1 other location - About 2 hrs to fix
      include/functions.php on lines 44..58

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

      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

      Method getAllPublished has 57 lines of code (exceeds 25 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: Major
      Found in class/class.latestnews.php - About 2 hrs to fix

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

            function cloneBlock($bid)
            {
                include_once dirname(__FILE__) . '/admin_header.php';
                //include_once 'admin_header.php';
                xoops_cp_header();
        Severity: Major
        Found in admin/blocksadmin.php - About 2 hrs to fix

          Method xtubeUpdateBlock has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function xtubeUpdateBlock($bid, $btitle, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $boptions, $groups)
              {
                  $myblock = new XoopsBlock($bid);
                  $myblock->setVar('title', $btitle);
                  $myblock->setVar('weight', $bweight);
          Severity: Minor
          Found in admin/blocksadmin.php - About 2 hrs to fix

            Method xtubeEditBlock has 50 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function xtubeEditBlock($bid)
                {
                    include_once dirname(__FILE__) . '/admin_header.php';
                    //include_once 'admin_header.php';
                    xoops_cp_header();
            Severity: Minor
            Found in admin/blocksadmin.php - About 2 hrs to fix

              Method check has 49 lines of code (exceeds 25 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 1 hr to fix

                Similar 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 1 hr to fix
                admin/blocksadmin.php on lines 313..325

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

                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 (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 1 hr to fix
                admin/blocksadmin.php on lines 51..63

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

                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 b_latestnews_edit has a Cognitive Complexity of 13 (exceeds 5 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: Minor
                Found in blocks/latestnews.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 extract_post_recursive has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    function extract_post_recursive( $key_name , $tmp_array )
                    {
                        $table = '' ;
                        $form = '' ;
                        foreach ($tmp_array as $key => $val) {
                Severity: Minor
                Found in include/gtickets.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 makeMySelBox has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function makeMySelBox($title, $order = "", $preset_id = 0, $none = 0, $sel_name = "", $onchange = "")
                    {
                        if ($sel_name == "") {
                            $sel_name = $this->id;
                        }
                Severity: Minor
                Found in class/xoopstree.php - About 1 hr to fix

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

                      function makeMySelBox($title, $order = "", $preset_id = 0, $none = 0, $sel_name = "", $onchange = "")
                      {
                          if ($sel_name == "") {
                              $sel_name = $this->id;
                          }
                  Severity: Minor
                  Found in class/xoopstree.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

                  Severity
                  Category
                  Status
                  Source
                  Language