XoopsModules25x/latestnews

View on GitHub
class/class.latestnews.php

Summary

Maintainability
D
2 days
Test Coverage

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

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 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 getAllPublished has 9 arguments (exceeds 4 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)
      Severity: Major
      Found in class/class.latestnews.php - About 1 hr to fix

        Function latest_news_is_admin_group has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            function latest_news_is_admin_group()
            {
                global $xoopsUser;
                $module_handler =& xoops_gethandler('module');
                $xoopsModule =& $module_handler->getByDirname('news');
        Severity: Minor
        Found in class/class.latestnews.php - About 55 mins 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