XoopsModules25x/wfdownloads

View on GitHub

Showing 279 of 279 total issues

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

<?php

namespace XoopsModules\Wfdownloads;

/**
Severity: Major
Found in class/XoopsTree.php and 1 other location - About 1 wk to fix
class/Common/XoopsTree.php on lines 1..359

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

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

<?php

namespace XoopsModules\Wfdownloads\Common;

/**
Severity: Major
Found in class/Common/XoopsTree.php and 1 other location - About 1 wk to fix
class/XoopsTree.php on lines 1..358

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

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 Utility.php has 1363 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace XoopsModules\Wfdownloads;

/*
Severity: Major
Found in class/Utility.php - About 3 days to fix

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

            if ($considerHtml) {
                // if the plain text is shorter than the maximum length, return the whole text
                if (mb_strlen(\preg_replace('/<.*?' . '>/', '', $text)) <= $length) {
                    return $text;
                }
    Severity: Major
    Found in class/Common/SysUtility.php and 1 other location - About 2 days to fix
    class/Utility.php on lines 1782..1849

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

    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 ($considerHtml) {
                // if the plain text is shorter than the maximum length, return the whole text
                if (mb_strlen(\preg_replace('/<.*?' . '>/', '', $text)) <= $length) {
                    return $text;
                }
    Severity: Major
    Found in class/Utility.php and 1 other location - About 2 days to fix
    class/Common/SysUtility.php on lines 63..130

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

    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 xoops_version.php has 965 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /*
     You may not change or alter any portion of this comment or credits
     of supporting developers from this source code or any supporting source code
     which is considered copyrighted (c) material of the original comment or credit authors.
    Severity: Major
    Found in xoops_version.php - About 2 days to fix

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

              if ($waiting_count > 0) {
                  foreach ($reviews_waiting as $review_waiting) {
                      $lids_waiting[] = $review_waiting->getVar('lid');
                      $uids_waiting[] = $review_waiting->getVar('uid');
                  }
      Severity: Major
      Found in admin/reviews.php and 1 other location - About 1 day to fix
      admin/reviews.php on lines 155..179

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

      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 ($published_count > 0) {
                  foreach ($reviews_published as $review_published) {
                      $lids_published[] = $review_published->getVar('lid');
                      $uids_published[] = $review_published->getVar('uid');
                  }
      Severity: Major
      Found in admin/reviews.php and 1 other location - About 1 day to fix
      admin/reviews.php on lines 129..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 401.

      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 downloads.php has 811 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /*
       You may not change or alter any portion of this comment or credits
       of supporting developers from this source code or any supporting source code
       which is considered copyrighted (c) material of the original comment or credit authors.
      Severity: Major
      Found in admin/downloads.php - About 1 day to fix

        File Download.php has 758 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        namespace XoopsModules\Wfdownloads;
        
        /*
        Severity: Major
        Found in class/Download.php - About 1 day to fix

          Function wfdownloads_search has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring.
          Open

          function wfdownloads_search($queryArray, $andor, $limit, $offset, $userId = 0, $categories = [], $sortBy = 0, $searchIn = '', $extra = '')
          {
              $helper = Helper::getInstance();
          
              $userGroups = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : [0 => XOOPS_GROUP_ANONYMOUS];
          Severity: Minor
          Found in include/search.inc.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

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

                  if ($published_count > 0) {
                      $lids_published = [];
                      $uids_published = [];
                      foreach ($mirrors_published as $mirror_published) {
                          $lids_published[] = $mirror_published->getVar('lid');
          Severity: Major
          Found in admin/mirrors.php and 1 other location - About 1 day to fix
          admin/mirrors.php on lines 126..146

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

          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 ($waiting_count > 0) {
                      $lids_waiting = [];
                      $uids_waiting = [];
                      foreach ($mirrors_waiting as $mirror_waiting) {
                          $lids_waiting[] = $mirror_waiting->getVar('lid');
          Severity: Major
          Found in admin/mirrors.php and 1 other location - About 1 day to fix
          admin/mirrors.php on lines 148..168

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

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

              public function getAdminForm($title, $customArray = []) // $custom array added April 22, 2006 by jwe
              {
                  require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
          
                  $use_mirrors = $this->helper->getConfig('enable_mirrors');
          Severity: Major
          Found in class/Download.php - About 1 day to fix

            File admin.php has 636 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            /*
             You may not change or alter any portion of this comment or credits
             of supporting developers from this source code or any supporting source code
             which is considered copyrighted (c) material of the original comment or credit authors.
            Severity: Major
            Found in language/english/admin.php - About 1 day to fix

              File import.php has 613 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              /*
               You may not change or alter any portion of this comment or credits
               of supporting developers from this source code or any supporting source code
               which is considered copyrighted (c) material of the original comment or credit authors.
              Severity: Major
              Found in admin/import.php - About 1 day to fix

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

                            if (Utility::checkModule('formulize') && $fid) {
                                require_once XOOPS_ROOT_PATH . '/modules/formulize/include/formdisplay.php';
                                require_once XOOPS_ROOT_PATH . '/modules/formulize/include/functions.php';
                                $customArray['fid']           = $fid;
                                $customArray['formulize_mgr'] = $helper->getHandler('Elements', 'formulize');
                Severity: Major
                Found in submit.php and 1 other location - About 1 day to fix
                admin/downloads.php on lines 122..149

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

                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 ($fid) {
                                    require_once XOOPS_ROOT_PATH . '/modules/formulize/include/formdisplay.php';
                                    require_once XOOPS_ROOT_PATH . '/modules/formulize/include/functions.php';
                                    $customArray['fid']           = $fid;
                                    $customArray['formulize_mgr'] = $helper->getHandler('Elements', 'formulize');
                Severity: Major
                Found in admin/downloads.php and 1 other location - About 1 day to fix
                submit.php on lines 147..174

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

                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

                <?php
                
                namespace XoopsModules\Wfdownloads;
                
                /*
                Severity: Major
                Found in class/ObjectTree.php and 1 other location - About 1 day to fix
                class/Common/ObjectTree.php on lines 1..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 285.

                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 3 locations. Consider refactoring.
                Open

                    case 'review.delete':
                        $review_id = Request::getInt('review_id', 0);
                        $ok        = Request::getBool('ok', false, 'POST');
                        if (!$reviewObj = $helper->getHandler('Review')->get($review_id)) {
                            redirect_header($currentFile, 4, _AM_WFDOWNLOADS_ERROR_REVIEWNOTFOUND);
                Severity: Major
                Found in admin/reviews.php and 2 other locations - About 1 day to fix
                admin/mimetypes.php on lines 153..174
                admin/mirrors.php on lines 36..57

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

                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