mambax7/gwiki

View on GitHub

Showing 181 of 181 total issues

File GwikiPage.php has 1739 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace XoopsModules\Gwiki;

use const _MI_GWIKI_WIKI404;
Severity: Major
Found in class/GwikiPage.php - About 4 days to fix

    Function showDOMNode has a Cognitive Complexity of 110 (exceeds 5 allowed). Consider refactoring.
    Open

    function showDOMNode(&$out, DOMNode $domNode, $nest, $lt, $ld, $nop)
    {
        foreach ($domNode->childNodes as $node) {
            switch ($node->nodeName) {
                case 'a':
    Severity: Minor
    Found in wizard.php - About 2 days 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

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

        if ($cnt > 0) {
            $sql    = 'SELECT image_file FROM ' . $xoopsDB->prefix('gwiki_page_images');
            $sql    .= ' WHERE keyword NOT IN (SELECT keyword from ' . $xoopsDB->prefix('gwiki_pages') . ')';
            $result = $xoopsDB->query($sql);
            while (false !== ($f = $xoopsDB->fetchArray($result))) {
    Severity: Major
    Found in cleanit.php and 1 other location - About 1 day to fix
    extras/cleanlitterbox.php on lines 62..87

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

    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 ($cnt > 0) {
            $sql    = 'SELECT image_file FROM ' . $xoopsDB->prefix('gwiki_page_images');
            $sql    .= ' WHERE keyword NOT IN (SELECT keyword from ' . $xoopsDB->prefix('gwiki_pages') . ')';
            $result = $xoopsDB->query($sql);
            while (false !== ($f = $xoopsDB->fetchArray($result))) {
    Severity: Major
    Found in extras/cleanlitterbox.php and 1 other location - About 1 day to fix
    cleanit.php on lines 51..76

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

    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

    File wizard.php has 631 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * wizard.php - wiki page creation wizard
     *
     * @copyright  Copyright © 2013 geekwright, LLC. All rights reserved.
    Severity: Major
    Found in wizard.php - About 1 day to fix

      GwikiPage has 67 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class GwikiPage
      {
          //------------------------------------------------------------
          // Properties -  public, protected, and private
          //------------------------------------------------------------
      Severity: Major
      Found in class/GwikiPage.php - About 1 day to fix

        File prefixes.php has 514 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        /**
         * admin/prefixes.php - manage wiki namespaces
         *
        Severity: Major
        Found in admin/prefixes.php - About 1 day to fix

          Function truncateHtml has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function truncateHtml($text, $length = 100, $ending = '...', $exact = false, $considerHtml = true)
              {
                  if ($considerHtml) {
                      // if the plain text is shorter than the maximum length, return the whole text
                      if (mb_strlen(\preg_replace('/<.*?' . '>/', '', $text)) <= $length) {
          Severity: Minor
          Found in class/Common/SysUtility.php - About 1 day 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 showAttachments has 189 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function showAttachments()
          {
              global $xoopsDB, $wikiPage;
              $dir = \basename(\dirname(__DIR__));
              /*
          Severity: Major
          Found in admin/attachments.php - About 7 hrs to fix

            File pages.php has 472 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            /**
             * admin/pages.php - manage wiki page revision
             *
             * @copyright  Copyright © 2013 geekwright, LLC. All rights reserved.
            Severity: Minor
            Found in admin/pages.php - About 7 hrs to fix

              Method __construct has 182 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function __construct($wordsPer = 100)
                  {
                      $this->wordsPerParagraph = $wordsPer;
                      $this->wordsPerSentence  = 24.460;
                      $this->words             = [
              Severity: Major
              Found in testing/LoremIpsumGenerator.php - About 7 hrs to fix

                Method showDOMNode has 181 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function showDOMNode(&$out, DOMNode $domNode, $nest, $lt, $ld, $nop)
                {
                    foreach ($domNode->childNodes as $node) {
                        switch ($node->nodeName) {
                            case 'a':
                Severity: Major
                Found in wizard.php - About 7 hrs to fix

                  File blocks.php has 449 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  /**
                   * blocks/blocks.php
                   *
                   * @param mixed $options
                  Severity: Minor
                  Found in blocks/blocks.php - About 6 hrs to fix

                    Method renderPage has 161 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function renderPage($body = null, $title = null)
                        {
                            if (empty($body)) {
                                $body = $this->body;
                            }
                    Severity: Major
                    Found in class/GwikiPage.php - About 6 hrs to fix

                      Function checkEdit has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function checkEdit()
                          {
                              global $xoopsUser, $xoopsDB;
                      
                              $mayEdit = false;
                      Severity: Minor
                      Found in class/GwikiPage.php - About 6 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 xoops_module_update_gwiki has 140 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function xoops_module_update_gwiki(\XoopsModule $module, $old_version)
                      {
                          global $xoopsDB;
                      
                          $error = false;
                      Severity: Major
                      Found in include/update.php - About 5 hrs to fix

                        Function renderLists has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private function renderLists($matches)
                            {
                                $lines = \explode("\n", $matches[0]);
                                $last  = '';
                                foreach ($lines as $i => $line) {
                        Severity: Minor
                        Found in class/GwikiPage.php - About 5 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 fbcom_plugin has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function fbcom_plugin(&$metas, $plugin_env)
                        {
                            global $xoopsDB;
                        
                            $helper = Helper::getInstance();
                        Severity: Minor
                        Found in include/fbcomment_plugin.php - About 5 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 addRevision has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function addRevision($leave_inactive = false)
                            {
                                global $xoopsDB;
                        
                                $page = $this->escapeForDB($this->keyword);
                        Severity: Minor
                        Found in class/GwikiPage.php - About 5 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 xoops_module_update_gwiki has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function xoops_module_update_gwiki(\XoopsModule $module, $old_version)
                        {
                            global $xoopsDB;
                        
                            $error = false;
                        Severity: Minor
                        Found in include/update.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

                        Severity
                        Category
                        Status
                        Source
                        Language