XoopsModules25x/wfdownloads

View on GitHub

Showing 182 of 279 total issues

Function convertorderbyin has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public static function convertorderbyin($orderby)
    {
        switch (\trim($orderby)) {
            case 'titleA':
                $orderby = 'title ASC';
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

Method getUserAverage has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

    Method addElement has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function addElement($formElement, $required = false, $row = null, $column = null)
        {
            if (null === $row) {
                $row = $this->_rows;
            }
    Severity: Minor
    Found in class/MulticolumnsThemeForm.php - About 1 hr to fix

      Consider simplifying this complex logical expression.
      Open

              if (!is_object($GLOBALS['xoopsUser'])
                  && (_WFDOWNLOADS_ANONPOST_MIRROR == $helper->getConfig('anonpost')
                      || _WFDOWNLOADS_ANONPOST_BOTH == $helper->getConfig('anonpost'))
                  && (_WFDOWNLOADS_SUBMISSIONS_MIRROR == $helper->getConfig('submissions')
                      || _WFDOWNLOADS_SUBMISSIONS_BOTH == $helper->getConfig('submissions'))) {
      Severity: Critical
      Found in mirror.php - About 1 hr to fix

        Function initZoom has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            }}, proto                                      : {initZoom: function () {
                var e, n = t.st.zoom, i = ".zoom";
                if (n.enabled && t.supportsTransition) {
                    var o, r, a = n.duration, s = function (e) {
                        var t = e.clone().removeAttr("style").removeAttr("class").addClass("mfp-animated-image"), i = "all " + n.duration / 1e3 + "s " + n.easing, o = {position: "fixed", zIndex: 9999, left: 0, top: 0, "-webkit-backface-visibility": "hidden"}, r = "transition";
        Severity: Minor
        Found in assets/js/magnific/jquery.magnific-popup.min.js - About 1 hr to fix

          Method wfdownloads_notify_iteminfo has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function wfdownloads_notify_iteminfo($category, $item_id)
          {
              global $xoopsModule, $xoopsModuleConfig;
          
              if (empty($xoopsModule) || 'wfdownloads' !== $xoopsModule->dirname()) {
          Severity: Minor
          Found in include/notification.inc.php - About 1 hr to fix

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

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

                Method isNewImage has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static function isNewImage($published)
                    {
                        if ($published <= 0) {
                            $indicator['image']   = 'assets/images/icon/download.gif';
                            $indicator['alttext'] = \_MD_WFDOWNLOADS_NO_FILES;
                Severity: Minor
                Found in class/Utility.php - About 1 hr to fix

                  Function rrmdir has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function rrmdir($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 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 getUserAverage has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function getUserAverage($criteria = null)
                      {
                          $groupby = false;
                          $field   = '';
                          if (null !== $criteria && $criteria instanceof \CriteriaElement) {
                  Severity: Minor
                  Found in class/RatingHandler.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 xoops_module_install_wfdownloads has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function xoops_module_install_wfdownloads(XoopsModule $module)
                  {
                      global $xoopsModule;
                      require_once dirname(__DIR__, 3) . '/mainfile.php';
                      require_once __DIR__ . '/common.php';
                  Severity: Minor
                  Found in include/oninstall.php - About 1 hr to fix

                    Method lettersChoice has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static function lettersChoice()
                        {
                            $helper = Helper::getInstance();
                    
                            $criteria = $helper->getHandler('Download')->getActiveCriteria();
                    Severity: Minor
                    Found in class/Utility.php - About 1 hr to fix

                      Method wfdownloads_top_show has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function wfdownloads_top_show($options)
                      {
                          if (!class_exists(Helper::class)) {
                              return false;
                          }
                      Severity: Minor
                      Found in blocks/top.php - About 1 hr to fix

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

                          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

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