mambax7/gwiki

View on GitHub

Showing 181 of 181 total issues

Method b_gwiki_related_show has 70 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function b_gwiki_related_show($options)
{
    global $xoTheme, $xoopsDB;

    $block = false;
Severity: Major
Found in blocks/blocks.php - About 2 hrs to fix

    Function showPages has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

    function showPages($message = null)
    {
        global $xoopsDB;
        echo <<<EOT
    <style>
    Severity: Minor
    Found in admin/pages.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

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

        if (isset($_POST['xoops_upload_file'][0])) {
            $filekey = $_POST['xoops_upload_file'][0];
            if (Request::hasVar('error', 'FILES[$filekey]) && !$_FILES[$filekey]')) {
                $zapus    = [' ', '/', '\\'];
                $filename = tempnam($pathname, 'IMPORTHTML_');
    Severity: Major
    Found in wizard.php and 1 other location - About 2 hrs to fix
    wizard.php on lines 121..133

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

    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

        if (isset($_POST['xoops_upload_file'][0])) {
            $filekey = $_POST['xoops_upload_file'][0];
            if (Request::hasVar('error', 'FILES[$filekey]) && !$_FILES[$filekey]')) {
                $zapus    = [' ', '/', '\\'];
                $filename = tempnam($pathname, 'IMPORTTEXT_');
    Severity: Major
    Found in wizard.php and 1 other location - About 2 hrs to fix
    wizard.php on lines 387..399

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

    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 truncateHtml has 63 lines of code (exceeds 25 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: Major
    Found in class/Common/SysUtility.php - About 2 hrs to fix

      Method fbcom_plugin has 61 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function fbcom_plugin(&$metas, $plugin_env)
      {
          global $xoopsDB;
      
          $helper = Helper::getInstance();
      Severity: Major
      Found in include/fbcomment_plugin.php - About 2 hrs to fix

        Function b_gwiki_related_show has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

        function b_gwiki_related_show($options)
        {
            global $xoTheme, $xoopsDB;
        
            $block = false;
        Severity: Minor
        Found in blocks/blocks.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

        Function deleteDirectory has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function deleteDirectory($src)
            {
                // 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 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

        Method b_gwiki_linkshere_show has 60 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function b_gwiki_linkshere_show($options)
        {
            global $xoTheme, $xoopsDB;
        
            $block = false;
        Severity: Major
        Found in blocks/blocks.php - About 2 hrs to fix

          Method renderLists has 57 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function renderLists($matches)
              {
                  $lines = \explode("\n", $matches[0]);
                  $last  = '';
                  foreach ($lines as $i => $line) {
          Severity: Major
          Found in class/GwikiPage.php - About 2 hrs to fix

            Function chooseWizard has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

            function chooseWizard()
            {
                global $wikiPage, $xoopsTpl;
                $helper = Helper::getInstance();
            
            
            Severity: Minor
            Found in wizard.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

            Function wikiLink has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                public function wikiLink($keyword, $altkey = null)
                {
                    global $xoopsDB;
            
                    // HACK - get rid of spaces in page
            Severity: Minor
            Found in class/GwikiPage.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

            Method checkEdit has 55 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function checkEdit()
                {
                    global $xoopsUser, $xoopsDB;
            
                    $mayEdit = false;
            Severity: Major
            Found in class/GwikiPage.php - About 2 hrs to fix

              Method getPage has 54 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function getPage($keyword, $id = null)
                  {
                      global $xoopsDB;
              
                      $this->resetPage();
              Severity: Major
              Found in class/GwikiPage.php - About 2 hrs to fix

                Method b_gwiki_recentblock_show has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function b_gwiki_recentblock_show($options)
                {
                    global $xoopsDB, $xoTheme;
                
                    $block = false;
                Severity: Major
                Found in blocks/blocks.php - About 2 hrs to fix

                  Method b_gwiki_teaserblock_show has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function b_gwiki_teaserblock_show($options)
                  {
                      global $xoopsDB, $xoopsConfig, $xoTheme;
                  
                      $block = false;
                  Severity: Major
                  Found in blocks/blocks.php - About 2 hrs to fix

                    Method wikiLink has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function wikiLink($keyword, $altkey = null)
                        {
                            global $xoopsDB;
                    
                            // HACK - get rid of spaces in page
                    Severity: Major
                    Found in class/GwikiPage.php - About 2 hrs to fix

                      Method updatePrefix has 49 lines of code (exceeds 25 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

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

                        function getUserName($uid)
                        {
                            global $xoopsConfig;
                        
                            $uid = (int)$uid;
                        Severity: Major
                        Found in ajaxfilelist.php and 1 other location - About 1 hr to fix
                        ajaxfileedit.php on lines 192..208

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

                        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

                        function getUserName($uid)
                        {
                            global $xoopsConfig;
                        
                            $uid = (int)$uid;
                        Severity: Major
                        Found in ajaxfileedit.php and 1 other location - About 1 hr to fix
                        ajaxfilelist.php on lines 42..58

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

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language