mambax7/marquee

View on GitHub

Showing 103 of 103 total issues

Function rrmdir has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public static function rrmdir($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 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 b_marquee_smartsection has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function b_marquee_smartsection($limit, $dateFormat, $itemsSize)
{

    if (!class_exists('XoopsModules\Smartsection\Helper')) {
        return false;
Severity: Minor
Found in plugins/smartsection.php - About 1 hr to fix

    Method loadTableFromArrayWithReplace has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function loadTableFromArrayWithReplace($table, $data, $search, $replace)
    {
        /** @var \XoopsMySQLDatabase $db */
        $db = \XoopsDatabaseFactory::getDatabaseConnection();
    
    
    Severity: Minor
    Found in testdata/index.php - About 1 hr to fix

      Method xoops_module_install_marquee has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function xoops_module_install_marquee(\XoopsModule $module)
      {
          require_once \dirname(__DIR__, 3) . '/mainfile.php';
          $moduleDirName = \basename(\dirname(__DIR__));
          /** @var Marquee\Helper $helper */ /** @var Marquee\Utility $utility */
      Severity: Minor
      Found in include/oninstall.php - About 1 hr to fix

        Method updateBlock has 9 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            function updateBlock($bid, $btitle, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options, $groups): void
        Severity: Major
        Found in admin/blocksadmin.php - About 1 hr to fix

          Function recurseCopy has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function recurseCopy($src, $dst): void
              {
                  $dir = \opendir($src);
                  //        @mkdir($dst);
                  try {
          Severity: Minor
          Found in class/Common/FilesManagement.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 xoopspartners_random has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function xoopspartners_random($numberPartners, $random = true, $orden = '', $desc = '')
          {
              global $xoopsDB;
              $PartnersId  = [];
              $ArrayReturn = [];
          Severity: Minor
          Found in plugins/xoopspartners.php - About 1 hr to fix

            Method xoops_module_update_marquee has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function xoops_module_update_marquee(\XoopsObject $module, $oldversion = null)
            {
                $db  = \XoopsDatabaseFactory::getDatabaseConnection();
                $sql = 'ALTER TABLE `' . $db->prefix('marquee') . "` MODIFY `marquee_bgcolor` VARCHAR(7) NOT NULL DEFAULT '';";
                $db->query($sql);
            Severity: Minor
            Found in include/update.php - About 1 hr to fix

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

                Method getModuleOption has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static function getModuleOption($option, $repmodule = 'marquee')
                    {
                        global $xoopsModule;
                        $helper = Helper::getInstance();
                        static $tbloptions = [];
                Severity: Minor
                Found in class/Utility.php - About 1 hr to fix

                  Method b_marquee_smartmedia has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function b_marquee_smartmedia($limit, $dateFormat, $itemsSize)
                  {
                      $block = [];
                      if (!defined('SMARTMEDIA_DIRNAME')) {
                          define('SMARTMEDIA_DIRNAME', 'smartmedia');
                  Severity: Minor
                  Found in plugins/smartmedia.php - About 1 hr to fix

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                        public static function queryAndCheck(\XoopsMySQLDatabase $xoopsDB, string $sql, $limit = 0, $start = 0): \mysqli_result
                        {
                            $result = $xoopsDB->query($sql, $limit, $start);
                    
                            if (!$xoopsDB->isResultSet($result)) {
                    Severity: Major
                    Found in class/Common/SysUtility.php and 1 other location - About 1 hr to fix
                    class/Common/SysUtility.php on lines 418..428

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

                    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

                        public static function queryFAndCheck(\XoopsMySQLDatabase $xoopsDB, string $sql, $limit = 0, $start = 0): \mysqli_result
                        {
                            $result = $xoopsDB->queryF($sql, $limit, $start);
                    
                            if (!$xoopsDB->isResultSet($result)) {
                    Severity: Major
                    Found in class/Common/SysUtility.php and 1 other location - About 1 hr to fix
                    class/Common/SysUtility.php on lines 396..406

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

                    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 XbMarquee has 8 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    function XbMarquee(id, height, width, scrollAmount, scrollDelay, direction, behavior, html) {
                    Severity: Major
                    Found in assets/js/xbMarquee.js - About 1 hr to fix

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                                      if (this.widthUnit == '%') {
                                          this.containerDiv.style.width =
                                              parentNode.offsetWidth * (this.width / 100) + 'px';
                                      }
                      Severity: Minor
                      Found in assets/js/xbMarquee.js and 1 other location - About 55 mins to fix
                      assets/js/xbMarquee.js on lines 219..222

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

                      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 (this.heightUnit == '%') {
                                          this.containerDiv.style.height =
                                              parentNode.offsetHeight * (this.height / 100) + 'px';
                                      }
                      Severity: Minor
                      Found in assets/js/xbMarquee.js and 1 other location - About 55 mins to fix
                      assets/js/xbMarquee.js on lines 224..227

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

                      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_marquee_tplleaguestats has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function b_marquee_tplleaguestats($limit, $dateFormat, $itemsSize)
                      {
                          //    require_once XOOPS_ROOT_PATH . '/modules/marquee/class/Utility.php';
                          //######################## SETTINGS ######################
                          $displaySeason  = false; // display season name?
                      Severity: Minor
                      Found in plugins/tplleaguestats.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

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

                          public static function formMarkRequiredFields($sform)
                          {
                              $required = $elements = [];
                              if (self::needsAsterisk()) {
                                  foreach ($sform->getRequired() as $item) {
                      Severity: Minor
                      Found in class/Utility.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

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

                      function b_marquee_comments($limit, $dateFormat, $itemsSize)
                      {
                          //    require_once XOOPS_ROOT_PATH . '/modules/marquee/class/Utility.php';
                          require XOOPS_ROOT_PATH . '/include/comment_constants.php';
                          $block  = [];
                      Severity: Minor
                      Found in plugins/comments.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

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

                          public static function rmove($src, $dest)
                          {
                              // 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 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

                      Severity
                      Category
                      Status
                      Source
                      Language