XoopsModules25x/xoopsfaq

View on GitHub

Showing 40 of 48 total issues

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

function xoopsfaq_rss(int $max = 10)
{
    /** @var Xoopsfaq\CategoryHandler $categoryHandler */
    /** @var Xoopsfaq\ContentsHandler $contentsHandler */
    $helper          = Helper::getInstance();
Severity: Minor
Found in include/rss.inc.php - About 1 hr to fix

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

    function xoopsfaq_rss(int $max = 10)
    {
        /** @var CategoryHandler $categoryHandler */
        /** @var ContentsHandler $contentsHandler */
        /** @var Helper $helper */
    Severity: Minor
    Found in include/rss.php - About 1 hr to fix

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

          final public static function rrmdir(string $src): bool
          {
              // 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 getServerStats has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

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

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

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

          function xoopsfaq_search($queryarray, $andor, $limit, $offset, $userid)
          {
              $ret = [];
              if (0 != $userid) {
                  return $ret;
          Severity: Minor
          Found in include/search.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

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

          function xoopsfaq_search($queryarray, $andor, $limit, $offset, $userid)
          {
              $ret = [];
              if (0 != $userid) {
                  return $ret;
          Severity: Minor
          Found in include/search.inc.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

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

              final public static function recurseCopy(string $src, string $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

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

              public static function renderIconLinks(array $icon_array, $param, $value = null, $extra = null): string
              {
                  $moduleDirName = \basename(\dirname(__DIR__));
                  \xoops_loadLanguage('admin', $moduleDirName);
                  $ret = '';
          Severity: Minor
          Found in class/Utility.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 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

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

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

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

                final public function rcopy(string $src, string $dest): bool
                {
                    // 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

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

            function b_xoopsfaq_random_show(array $options)
            {
                $moduleDirName = \basename(\dirname(__DIR__));
                $myts          = \MyTextSanitizer::getInstance();
            
            Severity: Minor
            Found in blocks/xoopsfaq_rand.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

            Method xoopsfaq_search has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            function xoopsfaq_search($queryarray, $andor, $limit, $offset, $userid)
            Severity: Minor
            Found in include/search.inc.php - About 35 mins to fix

              Method truncateHtml has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      string $text,
                      ?int   $length = null,
                      string $ending = '...',
                      bool   $exact = false,
                      bool   $considerHtml = true
              Severity: Minor
              Found in class/Common/SysUtility.php - About 35 mins to fix

                Method xoopsfaq_search has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                function xoopsfaq_search($queryarray, $andor, $limit, $offset, $userid)
                Severity: Minor
                Found in include/search.php - About 35 mins to fix

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

                      private function renameColumns(): void
                      {
                          foreach ($this->renameColumns as $tableName) {
                              if ($this->tableHandler->useTable($tableName)) {
                                  $oldName    = $tableName['from'];
                  Severity: Minor
                  Found in class/Common/Migrate.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 getEditor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function getEditor(?\Xmf\Module\Helper $helper = null, ?array $options = null): ?\XoopsFormTextArea
                      {
                          $descEditor = null;
                  
                          /** @var Helper $helper */
                  Severity: Minor
                  Found in class/Common/SysUtility.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 renderForm has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function renderForm()
                      {
                          /** @var CategoryHandler $categoryHandler */
                          /** @var Helper $helper */
                          $helper          = Helper::getHelper($this->dirname);
                  Severity: Minor
                  Found in class/Contents.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

                  Severity
                  Category
                  Status
                  Source
                  Language