XoopsModules25x/xoopsfaq

View on GitHub

Showing 48 of 48 total issues

Method b_xoopsfaq_recent_edit has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function b_xoopsfaq_recent_edit(array $options)
{
    $moduleDirName = \basename(\dirname(__DIR__));
    xoops_load('XoopsFormSelect');
Severity: Minor
Found in blocks/xoopsfaq_recent.php - About 1 hr to fix

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

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

      Method b_xoopsfaq_category_show has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function b_xoopsfaq_category_show(array $options)
      {
          $moduleDirName = \basename(\dirname(__DIR__));
      
          $myts = \MyTextSanitizer::getInstance();
      Severity: Minor
      Found in blocks/xoopsfaq_category.php - About 1 hr to fix

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

            public function renderAdminListing(?string $sort = null): string
            {
                $sort ??= 'id';
                //        if (!\class_exists('Xoopsfaq\Utility')) {
                //            \xoops_load('utility', \basename(\dirname(__DIR__)));
        Severity: Minor
        Found in class/CategoryHandler.php - About 1 hr to fix

          Function b_xoopsfaq_category_show has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

          function b_xoopsfaq_category_show(array $options)
          {
              $moduleDirName = \basename(\dirname(__DIR__));
          
              $myts = \MyTextSanitizer::getInstance();
          Severity: Minor
          Found in blocks/xoopsfaq_category.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 loadTableFromArrayWithReplace has a Cognitive Complexity of 13 (exceeds 5 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

          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_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

            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

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

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

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

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

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

                        public static function metaKeywords(string $content): void
                        {
                            global $xoopsTpl, $xoTheme;
                            $myts    = \MyTextSanitizer::getInstance();
                            $content = $myts->undoHtmlSpecialChars($myts->displayTarea($content));
                    Severity: Minor
                    Found in class/Common/SysUtility.php and 1 other location - About 55 mins to fix
                    class/Common/SysUtility.php on lines 120..130

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

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language