XoopsModules25x/xoopstube

View on GitHub

Showing 188 of 2,792 total issues

Function updateBlock has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    function updateBlock($bid, $btitle, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options, $groups)
    {
        $myblock = new \XoopsBlock($bid);
        $myblock->setVar('title', $btitle);
        $myblock->setVar('weight', $bweight);
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

Function getListTypeAsArray has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getListTypeAsArray($dirname, $type = '', $prefix = '', $noselection = 1)
    {
        $filelist = [];
        switch (\trim($type)) {
            case 'images':
Severity: Minor
Found in class/Lists.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

Function getListTypeAsArray has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    public function &getListTypeAsArray()
    {
        $filelist = [];
        switch (\trim($this->type)) {
            case 'images':
Severity: Minor
Found in class/FileList.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

File submit.php has 294 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Module: XoopsTube
 *
Severity: Minor
Found in submit.php - About 3 hrs to fix

    Method resizeThumbnail has 75 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function resizeThumbnail()
        {
            // Get image size and scale ratio
            $scale = \min($this->img_width / $this->_img_info[0], $this->img_height / $this->_img_info[1]);
            // If the image is larger than the max shrink it
    Severity: Major
    Found in class/Thumbnails.php - About 3 hrs to fix

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

          public static function cleanRequestVars(
              &$array,
              $name = null,
              $def = null,
              $strict = false,
      Severity: Minor
      Found in class/Utility.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

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

          public static function checkVerModule($helper, $source = 'github', $default = 'master')
          {
              $moduleDirName      = \basename(\dirname(__DIR__, 2));
              $moduleDirNameUpper = mb_strtoupper($moduleDirName);
              $update             = '';
      Severity: Minor
      Found in class/Common/VersionChecks.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

      Method getTotalItems has 69 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function getTotalItems($sel_id = 0, $get_child = 0, $return_sql = 0)
          {
              global $mytree, $_check_array;
      
              if ($sel_id > 0) {
      Severity: Major
      Found in class/Utility.php - About 2 hrs to fix

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

            function isBlockCloned($bid, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options = null)
            {
                xoops_loadLanguage('admin', 'system');
                xoops_loadLanguage('admin/blocksadmin', 'system');
                xoops_loadLanguage('admin/groups', 'system');
        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

        Method getSpotlightVideos has 65 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function getSpotlightVideos($options)
        {
            require_once dirname(__DIR__) . '/include/video.php';
            $block = [];
            /** @var \XoopsModuleHandler $moduleHandler */
        Severity: Major
        Found in blocks/xoopstube_top.php - About 2 hrs to fix

          Function xtubeShowVideo has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

          function xtubeShowVideo($vidid, $source, $screenshot, $picurl)
          {
              global $xoopsModule;
              $showvideo = '';
              $autoplay  = $GLOBALS['xoopsModuleConfig']['autoplay'];
          Severity: Minor
          Found in include/video.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

          Function resizeThumbnail has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

              public function resizeThumbnail()
              {
                  // Get image size and scale ratio
                  $scale = \min($this->img_width / $this->_img_info[0], $this->img_height / $this->_img_info[1]);
                  // If the image is larger than the max shrink it
          Severity: Minor
          Found in class/Thumbnails.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

          Method truncateHtml has 63 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function truncateHtml($text, $length = 100, $ending = '...', $exact = false, $considerHtml = true)
              {
                  if ($considerHtml) {
                      // if the plain text is shorter than the maximum length, return the whole text
                      if (mb_strlen(\preg_replace('/<.*?' . '>/', '', $text)) <= $length) {
          Severity: Major
          Found in class/Common/SysUtility.php - About 2 hrs to fix

            Method showTopVideoBlock has 61 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function showTopVideoBlock($options)
            {
                $moduleDirName = \basename(\dirname(__DIR__));
                $block         = [];
                /** @var \XoopsModuleHandler $moduleHandler */
            Severity: Major
            Found in blocks/xoopstube_top.php - About 2 hrs to fix

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

                  public static function deleteDirectory($src)
                  {
                      // Only continue if user is a 'global' Admin
                      if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
                          return false;
              Severity: Minor
              Found in class/Common/FilesManagement.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

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

              function showTopVideoBlock($options)
              {
                  $moduleDirName = \basename(\dirname(__DIR__));
                  $block         = [];
                  /** @var \XoopsModuleHandler $moduleHandler */
              Severity: Minor
              Found in blocks/xoopstube_top.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

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

              function getSpotlightVideos($options)
              {
                  require_once dirname(__DIR__) . '/include/video.php';
                  $block = [];
                  /** @var \XoopsModuleHandler $moduleHandler */
              Severity: Minor
              Found in blocks/xoopstube_top.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

              Method render has 58 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function render($alphaCount = null, $howmanyother = null)
                  {
                      $moduleDirName      = \basename(\dirname(__DIR__, 2));
                      $moduleDirNameUpper = mb_strtoupper($moduleDirName);
                      \xoops_loadLanguage('common', $moduleDirName);
              Severity: Major
              Found in class/Common/LetterChoice.php - About 2 hrs to fix

                Method fetchMedia has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function fetchMedia($media_name, $index = null)
                    {
                        global $_FILES;
                
                        if (!isset($_FILES[$media_name])) {
                Severity: Major
                Found in class/MediaUploader.php - About 2 hrs to fix

                  Function getBannerFromClientId has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function getBannerFromClientId($client_id)
                      {
                          ###### Hack by www.stefanosilvestrini.com ######
                          $db      = \XoopsDatabaseFactory::getDatabaseConnection();
                          $bresult = $db->query('SELECT COUNT(*) FROM ' . $db->prefix('banner') . ' WHERE cid=' . $client_id);
                  Severity: Minor
                  Found in class/Utility.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

                  Severity
                  Category
                  Status
                  Source
                  Language