mambax7/gwiki

View on GitHub

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

    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

                        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
                            Severity
                            Category
                            Status
                            Source
                            Language