mambax7/gwiki

View on GitHub

Showing 181 of 181 total issues

Method addRevision has 117 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function addRevision($leave_inactive = false)
    {
        global $xoopsDB;

        $page = $this->escapeForDB($this->keyword);
Severity: Major
Found in class/GwikiPage.php - About 4 hrs to fix

    File LoremIpsumGenerator.php has 357 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    // from http://snipplr.com/view.php?codeview&id=66113
    
    //if(!defined('BASEPATH'))
    //    exit('No direct script access allowed');
    Severity: Minor
    Found in testing/LoremIpsumGenerator.php - About 4 hrs to fix

      Function pageIndex has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

          private function pageIndex($prefix = null)
          {
              global $xoopsDB;
              $simplelayout = false;
              $tablayout    = false;
      Severity: Minor
      Found in class/GwikiPage.php - About 4 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 showPages has 101 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function showPages($message = null)
      {
          global $xoopsDB;
          echo <<<EOT
      <style>
      Severity: Major
      Found in admin/pages.php - About 4 hrs to fix

        File ajaxfileedit.php has 334 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /**
         * ajaxfileedit.php - backend upload attachments and update file info
         *
         * @copyright  Copyright © 2013 geekwright, LLC. All rights reserved.
        Severity: Minor
        Found in ajaxfileedit.php - About 4 hrs to fix

          File xoops_version.php has 333 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          require_once __DIR__ . '/preloads/autoloader.php';
          
          $moduleDirName = basename(__DIR__);
          Severity: Minor
          Found in xoops_version.php - About 4 hrs to fix

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

                    for ($j = 1; $j < $linklimit; ++$j) {
                        $text = trim($LIGen->getContent(1, 'txt', $loremipsum = false));
                        $text = str_replace('.', '', $text);
                        $link = str_replace([' ', '.', ',', "\t"], ['-', '', '', ''], $text);
                        $body = str_replace(' ' . $text . ' ', ' [[' . $link . '|' . $text . ']] ', $body);
            Severity: Major
            Found in testing/gen.php and 1 other location - About 4 hrs to fix
            testing/gen.php on lines 63..69

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

            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

                    for ($j = 1; $j < $linklimit; ++$j) {
                        $text = trim($LIGen->getContent(2, 'txt', $loremipsum = false));
                        $text = str_replace('.', '', $text);
                        $link = str_replace([' ', '.', ',', "\t"], ['-', '', '', ''], $text);
                        $body = str_replace(' ' . $text . ' ', ' [[' . $link . '|' . $text . ']] ', $body);
            Severity: Major
            Found in testing/gen.php and 1 other location - About 4 hrs to fix
            testing/gen.php on lines 53..59

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

            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

            Function renderTables has a Cognitive Complexity of 27 (exceeds 5 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 3 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

            Function renderImage has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
            Open

                private function renderImage($matches)
                {
                    $source = \trim($matches[1]);
                    $pos    = mb_strpos($source, '|');
                    //if($pos===false) $pos=strpos($source,' ');
            Severity: Minor
            Found in class/GwikiPage.php - About 3 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 showPrefixes has 93 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function showPrefixes()
            {
                global $xoopsDB;
                /*
                gwiki_prefix
            Severity: Major
            Found in admin/prefixes.php - About 3 hrs to fix

              Function showAttachments has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
              Open

              function showAttachments()
              {
                  global $xoopsDB, $wikiPage;
                  $dir = \basename(\dirname(__DIR__));
                  /*
              Severity: Minor
              Found in admin/attachments.php - About 3 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 getExtensionInfo has 87 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function getExtensionInfo($filename)
              {
                  global $whitelist;
              
                  $fi = [];
              Severity: Major
              Found in ajaxfileedit.php - About 3 hrs to fix

                Method chooseWizard has 82 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function chooseWizard()
                {
                    global $wikiPage, $xoopsTpl;
                    $helper = Helper::getInstance();
                
                
                Severity: Major
                Found in wizard.php - About 3 hrs to fix

                  Method renderImage has 81 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function renderImage($matches)
                      {
                          $source = \trim($matches[1]);
                          $pos    = mb_strpos($source, '|');
                          //if($pos===false) $pos=strpos($source,' ');
                  Severity: Major
                  Found in class/GwikiPage.php - About 3 hrs to fix

                    Method pageIndex has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private function pageIndex($prefix = null)
                        {
                            global $xoopsDB;
                            $simplelayout = false;
                            $tablayout    = false;
                    Severity: Major
                    Found in class/GwikiPage.php - About 3 hrs to fix

                      File edit.php has 296 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      <?php
                      
                      /**
                       * edit.php - edit a wiki page
                       *
                      Severity: Minor
                      Found in edit.php - About 3 hrs to fix

                        Function renderLink has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private function renderLink($matches)
                            {
                                $source = \trim($matches[1]);
                                $pos    = mb_strpos($source, '|');
                        
                        
                        Severity: Minor
                        Found in class/GwikiPage.php - About 3 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 renderPageSetNav has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function renderPageSetNav($page)
                            {
                                $sethome = $page;
                                $toc     = $this->fetchPageSetToc($sethome); // this will set home
                                if (!$toc) {
                        Severity: Major
                        Found in class/GwikiPage.php - About 2 hrs to fix

                          Function checkVerModule has a Cognitive Complexity of 21 (exceeds 5 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 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

                          Severity
                          Category
                          Status
                          Source
                          Language