mambax7/gwiki

View on GitHub

Showing 181 of 181 total issues

Method installTemplate has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function installTemplate($pid, $delete = false)
{
    global $xoopsModule;

    $template = getPrefix($pid);
Severity: Minor
Found in admin/prefixes.php - About 1 hr to fix

    Function renderRef has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        private function renderRef($matches)
        {
            $refinfo      = $matches[1];
            $source       = $matches[2];
            $first_ref    = false;
    Severity: Minor
    Found in class/GwikiPage.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 fetchPageSetToc has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        public function fetchPageSetToc(&$page)
        {
            global $xoopsDB;
            $toc = false;
    
    
    Severity: Minor
    Found in class/GwikiPage.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 renderPageSetNav has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        public function renderPageSetNav($page)
        {
            $sethome = $page;
            $toc     = $this->fetchPageSetToc($sethome); // this will set home
            if (!$toc) {
    Severity: Minor
    Found in class/GwikiPage.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 updateData has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function updateData(&$input)
    {
        global $xoopsDB, $xoopsUser, $wikiPage;
    
        $q_file_id          = (int)$input['file_id'];
    Severity: Minor
    Found in ajaxfileedit.php - About 1 hr to fix

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

      function confirmAction($action, $keyword = '', $id = -1)
      {
          adminTableStart(_AD_GWIKI_CONFIRM, 1);
          echo '<tr><td width="100%" >';
          echo '<div class="confirmMsg">';
      Severity: Minor
      Found in admin/pages.php - About 1 hr to fix

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

            private function renderLink($matches)
            {
                $source = \trim($matches[1]);
                $pos    = mb_strpos($source, '|');
        
        
        Severity: Minor
        Found in class/GwikiPage.php - About 1 hr to fix

          Function b_gwiki_teaserblock_show has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

          function b_gwiki_teaserblock_show($options)
          {
              global $xoopsDB, $xoopsConfig, $xoTheme;
          
              $block = false;
          Severity: Minor
          Found in blocks/blocks.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 gwiki_search has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function gwiki_search($queryarray, $andor, $limit, $offset, $userid, $prefix = null)
          {
              global $xoopsDB;
          
              $dir = \basename(\dirname(__DIR__));
          Severity: Minor
          Found in include/search.inc.php - About 1 hr to fix

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

                private function renderTables($matches)
                {
                    $source = $matches[0];
                    $rowcnt = 0;
                    $table  = "<table class=\"wikitable\">\n";
            Severity: Minor
            Found in class/GwikiPage.php - About 1 hr to fix

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

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

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

                if ($pageX) {
                    $pageX['author']       = $wikiPage->getUserName($wikiPage->uid);
                    $pageX['revisiontime'] = date($wikiPage->dateFormat, $pageX['lastmodified']);
                    $pageX['mayEdit']      = $mayEdit;
                    $pageX['pageFound']    = true;
                Severity: Major
                Found in edit.php and 1 other location - About 1 hr to fix
                wizard.php on lines 713..727

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

                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

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

                if ($pageX) {
                    $pageX['author']       = $wikiPage->getUserName($wikiPage->uid);
                    $pageX['revisiontime'] = date($wikiPage->dateFormat, $pageX['lastmodified']);
                    $pageX['mayEdit']      = $mayEdit;
                    $pageX['pageFound']    = true;
                Severity: Major
                Found in wizard.php and 1 other location - About 1 hr to fix
                edit.php on lines 136..153

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

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

                function updateTemplate($pid)
                {
                    global $xoopsDB, $wikiPage;
                
                    $row = getPrefix($pid);
                Severity: Minor
                Found in admin/prefixes.php - About 1 hr to fix

                  Method getUserNamespaces has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function getUserNamespaces($createonly = false)
                      {
                          global $xoopsUser, $xoopsDB;
                  
                          $dir = $this->wikiDir;
                  Severity: Minor
                  Found in class/GwikiPage.php - About 1 hr to fix

                    Method gwiki_notify_iteminfo has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        function gwiki_notify_iteminfo($category, $item_id)
                        {
                            global $xoopsDB;
                            $helper = Helper::getInstance();
                    
                    
                    Severity: Minor
                    Found in include/notification.inc.php - About 1 hr to fix

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

                      function updatePrefix($pid)
                      {
                          global $xoopsDB, $wikiPage;
                      
                          $row = getPrefix($pid);
                      Severity: Minor
                      Found in admin/prefixes.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($table, $data, $search, $replace)
                      {
                          /** @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 do_clean has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function do_clean()
                      {
                          global $xoopsDB;
                      
                          $helper = Helper::getInstance();
                      Severity: Minor
                      Found in cleanit.php - About 1 hr to fix

                        Method updateData has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function updateData(&$input)
                        {
                            global $xoopsDB, $wikiPage;
                        
                            $q_image_id       = (int)$input['image_id'];
                        Severity: Minor
                        Found in ajaximgedit.php - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language