mambax7/xoopsheadline

View on GitHub

Showing 53 of 59 total issues

Method orderBlock has 15 arguments (exceeds 4 allowed). Consider refactoring.
Open

        array $bid,
        array $oldtitle,
        array $oldside,
        array $oldweight,
        array $oldvisible,
Severity: Major
Found in class/Common/Blocksadmin.php - About 1 hr to fix

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

        public static function checkVerModule(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 updateBlock has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function updateBlock(int $bid, string $btitle, string $bside, string $bweight, string $bvisible, string $bcachetime, ?array $bmodule, ?array $options, ?array $groups): void
          {
              $myblock = new \XoopsBlock($bid);
              $myblock->setVar('title', $btitle);
              $myblock->setVar('weight', $bweight);
      Severity: Minor
      Found in class/Common/Blocksadmin.php - About 1 hr to fix

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

        function loadTableFromArrayWithReplace(string $table, array $data, string $search, string $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

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

            public function isBlockCloned(int $bid, string $bside, string $bweight, string $bvisible, string $bcachetime, ?array $bmodule, ?array $options, ?array $groups): void
            {
                \xoops_loadLanguage('admin', 'system');
                \xoops_loadLanguage('admin/blocksadmin', 'system');
                \xoops_loadLanguage('admin/groups', 'system');
        Severity: Minor
        Found in class/Common/Blocksadmin.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 xcopy has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function xcopy(string $source, string $dest): bool
            {
                // Check for symlinks
                if (\is_link($source)) {
                    return \symlink(\readlink($source), $dest);
        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 orderBlock has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function orderBlock(
                array $bid,
                array $oldtitle,
                array $oldside,
                array $oldweight,
        Severity: Minor
        Found in class/Common/Blocksadmin.php - About 1 hr to fix

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

              public function updateCache()
              {
                  $helper = Helper::getInstance();
                  /**
                   * Update cache - first try using fopen and then cURL
          Severity: Minor
          Found in class/HeadlineRenderer.php - About 1 hr to fix

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

                public function renderBlock(bool $force_update = false): bool
                {
                    $retval = false;
                    if ($force_update || $this->headline->cacheExpired()) {
                        if (!$this->updateCache()) {
            Severity: Minor
            Found in class/HeadlineRenderer.php - About 1 hr to fix

              Method cloneBlock has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function cloneBlock(int $bid): void
                  {
                      //require __DIR__ . '/admin_header.php';
                      //        \xoops_cp_header();
              
              
              Severity: Minor
              Found in class/Common/Blocksadmin.php - About 1 hr to fix

                Method editBlock has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function editBlock(int $bid): void
                    {
                        //        require_once \dirname(__DIR__,2) . '/admin/admin_header.php';
                        //        \xoops_cp_header();
                        \xoops_loadLanguage('admin', 'system');
                Severity: Minor
                Found in class/Common/Blocksadmin.php - About 1 hr to fix

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

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

                  function xoops_module_install_xoopsheadline(\XoopsModule $module): bool
                  {
                      require_once \dirname(__DIR__, 3) . '/mainfile.php';
                  
                      $moduleDirName = \basename(\dirname(__DIR__));
                  Severity: Minor
                  Found in include/oninstall.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, string $replace): int
                    {
                        /** @var \XoopsMySQLDatabase $db */
                        $db = \XoopsDatabaseFactory::getDatabaseConnection();
                    
                    
                    Severity: Minor
                    Found in testdata/index.php - About 1 hr to fix

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

                          public function updateBlock(int $bid, string $btitle, string $bside, string $bweight, string $bvisible, string $bcachetime, ?array $bmodule, ?array $options, ?array $groups): void
                      Severity: Major
                      Found in class/Common/Blocksadmin.php - About 1 hr to fix

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

                                public function isBlockCloned(int $bid, string $bside, string $bweight, string $bvisible, string $bcachetime, ?array $bmodule, ?array $options, ?array $groups): void
                            Severity: Major
                            Found in class/Common/Blocksadmin.php - About 1 hr to fix

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

                                  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

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

                              Severity
                              Category
                              Status
                              Source
                              Language