XoopsModules25x/wfdownloads

View on GitHub

Showing 279 of 279 total issues

Method loadTableFromArrayWithReplace has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function loadTableFromArrayWithReplace($table, $data, $search, $replace)
{
    /** @var \XoopsMySQLDatabase $db */
    $db = XoopsDatabaseFactory::getDatabaseConnection();

Severity: Minor
Found in testdata/index.php - About 1 hr to fix

    Method invert_nohtm_dohtml_values has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function invert_nohtm_dohtml_values()
    {
        $ret               = [];
        $categoriesHandler = $helper->getHandler('Category');
        $result            = $GLOBALS['xoopsDB']->query('SHOW COLUMNS FROM ' . $categoriesHandler->table);
    Severity: Minor
    Found in include/onupdate.php - About 1 hr to fix

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

          if ($max_requestid) {
              $GLOBALS['xoopsDB']->query('UPDATE ' . $destination['mod'] . ' m, ' . $destination['cat'] . ' c SET m.cid=c.cid' . ' WHERE m.requestid > ' . $max_requestid . ' AND c.old_cid=m.cid');
              //Update lid values in mod table
              $GLOBALS['xoopsDB']->query('UPDATE ' . $destination['mod'] . ' m, ' . $destination['downloads'] . ' d SET m.lid=d.lid' . ' WHERE m.requestid > ' . $max_requestid . ' AND m.lid=d.old_lid');
          }
      Severity: Major
      Found in admin/import.php and 2 other locations - About 1 hr to fix
      admin/import.php on lines 546..550
      admin/import.php on lines 647..651

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

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

          if ($max_requestid) {
              $GLOBALS['xoopsDB']->query('UPDATE ' . $destination['mod'] . ' m, ' . $destination['cat'] . ' c SET m.cid=c.cid' . ' WHERE m.requestid > ' . $max_requestid . ' AND c.old_cid=m.cid');
              //Update lid values in mod table
              $GLOBALS['xoopsDB']->query('UPDATE ' . $destination['mod'] . ' m, ' . $destination['downloads'] . ' d SET m.lid=d.lid' . ' WHERE m.requestid > ' . $max_requestid . ' AND m.lid=d.old_lid');
          }
      Severity: Major
      Found in admin/import.php and 2 other locations - About 1 hr to fix
      admin/import.php on lines 546..550
      admin/import.php on lines 747..751

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

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

          if ($max_requestid) {
              $GLOBALS['xoopsDB']->query('UPDATE ' . $destination['mod'] . ' m, ' . $destination['cat'] . ' c SET m.cid=c.cid' . ' WHERE m.requestid > ' . $max_requestid . ' AND c.old_cid=m.cid');
              //Update lid values in mod table
              $GLOBALS['xoopsDB']->query('UPDATE ' . $destination['mod'] . ' m, ' . $destination['downloads'] . ' d SET m.lid=d.lid' . ' WHERE m.requestid > ' . $max_requestid . ' AND m.lid=d.old_lid');
          }
      Severity: Major
      Found in admin/import.php and 2 other locations - About 1 hr to fix
      admin/import.php on lines 647..651
      admin/import.php on lines 747..751

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

      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 updateBlock has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          function updateBlock($bid, $btitle, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options, $groups)
      Severity: Major
      Found in admin/blocksadmin.php - About 1 hr to fix

        Method wfdownloads_search has 9 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        function wfdownloads_search($queryArray, $andor, $limit, $offset, $userId = 0, $categories = [], $sortBy = 0, $searchIn = '', $extra = '')
        Severity: Major
        Found in include/search.inc.php - About 1 hr to fix

          Function initGallery has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              e.magnificPopup.registerModule("gallery", {options: {enabled: !1, arrowMarkup: '<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>', preload: [0, 2], navigateByImgClick: !0, arrows: !0, tPrev: "Previous (Left arrow key)", tNext: "Next (Right arrow key)", tCounter: "%curr% of %total%"}, proto: {initGallery: function () {
                  var n = t.st.gallery, i = ".mfp-gallery", r = Boolean(e.fn.mfpFastClick);
                  return t.direction = !0, n && n.enabled ? (a += " mfp-gallery", x(f + i, function () {
                      n.navigateByImgClick && t.wrap.on("click" + i, ".mfp-img", function () {
                          return t.items.length > 1 ? (t.next(), !1) : void 0
          Severity: Minor
          Found in assets/js/magnific/jquery.magnific-popup.min.js - About 1 hr to fix

            Method updateTable has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function updateTable(DbupdaterTable $table)
                {
                    $ret = true;
                    echo '<ul>';
            
            
            Severity: Minor
            Found in class/Dbupdater.php - About 1 hr to fix

              Method getMaxPublishdate has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function getMaxPublishdate(\CriteriaElement $criteria = null)
                  {
                      $field = '';
                      $groupby = false;
                      if (null !== $criteria && $criteria instanceof \CriteriaElement) {
              Severity: Minor
              Found in class/DownloadHandler.php - About 1 hr to fix

                Function toolbar has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function toolbar()
                    {
                        $helper = Helper::getInstance();
                
                        $isSubmissionAllowed = false;
                Severity: Minor
                Found in class/Utility.php - About 1 hr 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 convertOrderByTrans has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function convertOrderByTrans($orderby)
                    {
                        $orderbyTrans = '';
                        if ('title ASC' === $orderby) {
                            $orderbyTrans = \_MD_WFDOWNLOADS_TITLEATOZ;
                Severity: Minor
                Found in class/Utility.php - About 1 hr 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 convertorderbyout has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function convertorderbyout($orderby)
                    {
                        if ('title ASC' === $orderby) {
                            $orderby = 'titleA';
                        }
                Severity: Minor
                Found in class/Utility.php - About 1 hr 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 getMaxPublishdate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getMaxPublishdate(\CriteriaElement $criteria = null)
                    {
                        $field = '';
                        $groupby = false;
                        if (null !== $criteria && $criteria instanceof \CriteriaElement) {
                Severity: Minor
                Found in class/DownloadHandler.php - About 1 hr 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 updateTable has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function updateTable(DbupdaterTable $table)
                    {
                        $ret = true;
                        echo '<ul>';
                
                
                Severity: Minor
                Found in class/Dbupdater.php - About 1 hr 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 getFileStatus has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function getFileStatus($file_path, $original_file_path = null, $redirectFile = null)
                    {
                        global $pathIcon16;
                
                        if (empty($file_path)) {
                Severity: Minor
                Found in class/Common/FileChecker.php - About 1 hr 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 displayCategory has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static function displayCategory(Wfdownloads\Category $categoryObj, $level = 0)
                    {
                        $helper = Helper::getInstance();
                
                        $description = $categoryObj->description();
                Severity: Minor
                Found in class/Utility.php - About 1 hr to fix

                  Method loadSampleData has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function loadSampleData()
                  {
                      global $xoopsConfig;
                      $moduleDirName      = basename(dirname(__DIR__));
                      $moduleDirNameUpper = mb_strtoupper($moduleDirName);
                  Severity: Minor
                  Found in testdata/index.php - About 1 hr to fix

                    Method toolbar has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static function toolbar()
                        {
                            $helper = Helper::getInstance();
                    
                            $isSubmissionAllowed = false;
                    Severity: Minor
                    Found in class/Utility.php - About 1 hr to fix

                      Method createThumb has 8 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          public static function createThumb($imgName, $imgPath, $imgSavePath, $width = 100, $height = 100, $quality = 100, $update = false, $aspect = 1)
                      Severity: Major
                      Found in class/Utility.php - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language