XoopsModules25x/news

View on GitHub

Showing 236 of 310 total issues

Function bodytext has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function bodytext($format = 'Show')
    {
        $myts   = MyTextSanitizer::getInstance();
        $html   = 1;
        $smiley = 1;
Severity: Minor
Found in class/XoopsStory.php - About 35 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

Function resizePicture has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function resizePicture(
        $src_path,
        $dst_path,
        $param_width,
        $param_height,
Severity: Minor
Found in class/Utility.php - About 35 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

Avoid too many return statements within this method.
Open

    return null;
Severity: Major
Found in include/notification.inc.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

            return null;
    Severity: Major
    Found in include/notification.inc.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

          return false;
      Severity: Major
      Found in include/install_function.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return null;
        Severity: Major
        Found in class/NewsStory.php - About 30 mins to fix

          Function getCountbyStories has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getCountbyStories($stories)
              {
                  $ret = [];
                  if (\count($stories) > 0) {
                      $sql    = 'SELECT storyid, count(fileid) AS cnt FROM ' . $this->table . ' WHERE storyid IN (';
          Severity: Minor
          Found in class/Files.php - About 25 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

          Function xoops_module_install_news has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          function xoops_module_install_news(\XoopsModule $module)
          {
              require_once \dirname(__DIR__, 3) . '/mainfile.php';
          
              $moduleDirName = \basename(\dirname(__DIR__));
          Severity: Minor
          Found in include/oninstall.php - About 25 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

          Function topic_imgurl has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function topic_imgurl($format = 'S')
              {
                  if ('' === \trim($this->topic_imgurl)) {
                      $this->topic_imgurl = 'blank.png';
                  }
          Severity: Minor
          Found in class/NewsTopic.php - About 25 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

          Function getAllChild has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getAllChild($key, $ret = [])
              {
                  if (isset($this->tree[$key]['child'])) {
                      foreach ($this->tree[$key]['child'] as $childKey) {
                          $ret[$childKey] = $this->tree[$childKey]['obj'];
          Severity: Minor
          Found in class/ObjectTree.php - About 25 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

          Function getAllKeywords has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getAllKeywords()
              {
                  $ret      = $tbl_black_list = [];
                  $myts     = \MyTextSanitizer::getInstance();
                  $filename = XOOPS_UPLOAD_PATH . '/news_black_list.php';
          Severity: Minor
          Found in class/Blacklist.php - About 25 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

          Function loadSampleData has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          function loadSampleData(): void
          {
              global $xoopsConfig;
              $moduleDirName      = \basename(\dirname(__DIR__));
              $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
          Severity: Minor
          Found in testdata/index.php - About 25 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

          Function makeMyTopicSelBox has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function makeMyTopicSelBox(
                  $none = 0,
                  $seltopic = -1,
                  $selname = '',
                  $onchange = '',
          Severity: Minor
          Found in class/NewsTopic.php - About 25 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

          Function getMetagen has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          function getMetagen(): void
          {
              require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
              global $xoopsModule, $xoopsConfig, $cfg;
              $helper = Helper::getInstance();
          Severity: Minor
          Found in admin/index.php - About 25 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

          Function topic_imgurl has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function topic_imgurl($format = 'S')
              {
                  if ('' === \trim($this->topic_imgurl)) {
                      $this->topic_imgurl = 'blank.png';
                  }
          Severity: Minor
          Found in class/NewsStory.php - About 25 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

          Function getAllExpired has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function getAllExpired($limit = 0, $start = 0, $topic = 0, $ihome = 0, $asobject = true)
              {
                  /** @var \XoopsMySQLDatabase $db */
                  $db   = \XoopsDatabaseFactory::getDatabaseConnection();
                  $myts = \MyTextSanitizer::getInstance();
          Severity: Minor
          Found in class/NewsStory.php - About 25 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

          Severity
          Category
          Status
          Source
          Language