mambax7/waiting

View on GitHub

Showing 74 of 74 total issues

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

function waiting_get_plugin_info($dirname, $language = 'english')
{
    // get $mytrustdirname for D3 modules
    $mytrustdirname = '';
    if (defined('XOOPS_TRUST_PATH') && is_file(XOOPS_ROOT_PATH . '/modules/' . $dirname . '/mytrustdirname.php')) {
Severity: Minor
Found in include/functions.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

    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

    Method b_waiting_waiting_show has 55 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function b_waiting_waiting_show($options)
    {
        $userLang = $GLOBALS['xoopsConfig']['language'];
    
        $sql_cache_min  = empty($options[1]) ? 0 : (int)$options[1];
    Severity: Major
    Found in blocks/waiting_waiting.php - About 2 hrs to fix

      Method waiting_get_plugin_info has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function waiting_get_plugin_info($dirname, $language = 'english')
      {
          // get $mytrustdirname for D3 modules
          $mytrustdirname = '';
          if (defined('XOOPS_TRUST_PATH') && is_file(XOOPS_ROOT_PATH . '/modules/' . $dirname . '/mytrustdirname.php')) {
      Severity: Major
      Found in include/functions.php - About 2 hrs to fix

        Function xoops_module_update_waiting has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

        function xoops_module_update_waiting($module, $version)
        {
            return true;  // force return - following code is really only needed for XOOPS < 2.3
            // Keep Block option values when update (by nobunobu)
            $mid = $module->mid();
        Severity: Minor
        Found in include/updateblock.inc.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 xoops_module_update_waiting has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function xoops_module_update_waiting($module, $version)
        {
            return true;  // force return - following code is really only needed for XOOPS < 2.3
            // Keep Block option values when update (by nobunobu)
            $mid = $module->mid();
        Severity: Major
        Found in include/updateblock.inc.php - About 2 hrs to fix

          Method checkVerModule has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function checkVerModule(\Xmf\Module\Helper $helper, ?string $source = 'github', ?string $default = 'master'): ?array
              {
                  $moduleDirName      = \basename(\dirname(__DIR__, 2));
                  $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
                  $update             = '';
          Severity: Minor
          Found in class/Common/VersionChecks.php - About 1 hr to fix

            Method b_waiting_wfdownloads has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function b_waiting_wfdownloads()
            {
                /** @var \XoopsMySQLDatabase $xoopsDB */
                $xoopsDB = \XoopsDatabaseFactory::getDatabaseConnection();
                $ret     = [];
            Severity: Minor
            Found in plugins/wfdownloads.php - About 1 hr to fix

              Method b_waiting_smartfaq has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function b_waiting_smartfaq()
              {
                  /** @var \XoopsMySQLDatabase $xoopsDB */
                  $xoopsDB = \XoopsDatabaseFactory::getDatabaseConnection();
                  $ret     = [];
              Severity: Minor
              Found in plugins/smartfaq.php - About 1 hr to fix

                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 xoops_module_install_waiting has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function xoops_module_install_waiting(\XoopsModule $module)
                {
                    require_once \dirname(__DIR__, 3) . '/mainfile.php';
                    //    require_once   \dirname(__DIR__) . '/config/config.php';
                
                
                Severity: Minor
                Found in include/oninstall.php - About 1 hr to fix

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

                      public static function getServerStats()
                      {
                          $moduleDirName      = \basename(\dirname(__DIR__, 2));
                          $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
                          \xoops_loadLanguage('common', $moduleDirName);
                  Severity: Minor
                  Found in class/Common/ServerStats.php - About 1 hr to fix

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

                        } elseif (!empty($mytrustdirname) && file_exists($d3module_plugin_file)) {
                            // D3 module's plugin under xoops_trust_path (2nd priority)
                            $lang_files    = [
                                XOOPS_TRUST_PATH . "/modules/$mytrustdirname/language/$language/waiting.php",
                                XOOPS_TRUST_PATH . "/modules/$mytrustdirname/language/english/waiting.php",
                    Severity: Major
                    Found in include/functions.php and 1 other location - About 1 hr to fix
                    include/functions.php on lines 58..106

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

                    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 (file_exists($module_plugin_file)) {
                            // module side (1st priority)
                            $lang_files    = [
                                XOOPS_ROOT_PATH . "/modules/$dirname/language/$language/waiting.php",
                                XOOPS_ROOT_PATH . "/modules/$dirname/language/english/waiting.php",
                    Severity: Major
                    Found in include/functions.php and 1 other location - About 1 hr to fix
                    include/functions.php on lines 77..96

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

                    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

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

                    function b_waiting_PDdownloads()
                    {
                        /** @var \XoopsMySQLDatabase $xoopsDB */
                        $xoopsDB = \XoopsDatabaseFactory::getDatabaseConnection();
                        $ret     = [];
                    Severity: Minor
                    Found in plugins/pddownloads.php - About 1 hr to fix

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

                      function b_waiting_xyp4all()
                      {
                          /** @var \XoopsMySQLDatabase $xoopsDB */
                          $xoopsDB = \XoopsDatabaseFactory::getDatabaseConnection();
                          $ret     = [];
                      Severity: Minor
                      Found in plugins/xyp4all.php - About 1 hr to fix

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

                        function b_waiting_mydownloads()
                        {
                            /** @var \XoopsMySQLDatabase $xoopsDB */
                            $xoopsDB = \XoopsDatabaseFactory::getDatabaseConnection();
                            $ret     = [];
                        Severity: Minor
                        Found in plugins/mydownloads.php - About 1 hr to fix

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

                          function b_waiting_mylinks()
                          {
                              /** @var \XoopsMySQLDatabase $xoopsDB */
                              $xoopsDB = \XoopsDatabaseFactory::getDatabaseConnection();
                              $ret     = [];
                          Severity: Minor
                          Found in plugins/mylinks.php - About 1 hr to fix

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

                            function b_waiting_xdirectory()
                            {
                                /** @var \XoopsMySQLDatabase $xoopsDB */
                                $xoopsDB = \XoopsDatabaseFactory::getDatabaseConnection();
                                $ret     = [];
                            Severity: Minor
                            Found in plugins/xdirectory.php - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language