XoopsModules25x/latestnews

View on GitHub
blocks/latestnews.php

Summary

Maintainability
F
3 days
Test Coverage

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

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

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

        There are no issues that match your filters.

        Category
        Status