mambax7/wflinks

View on GitHub

Showing 201 of 201 total issues

Function convertOrderByOut has a Cognitive Complexity of 11 (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

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

function fetchURL($url, $timeout = 2)
{
    /** @var Helper $helper */
    $helper     = Helper::getInstance();
    $url        = urldecode($url);
Severity: Minor
Found in admin/main.php - About 1 hr to fix

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

        public static function convertOrderByTrans($orderby)
        {
            if ('hits ASC' === $orderby) {
                $orderbyTrans = _MD_WFL_POPULARITYLTOM;
            }
    Severity: Minor
    Found in class/Utility.php - About 1 hr to fix

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

          public static function getForum($type, $selected)
          {
              global $xoopsDB;
              switch (\xoops_trim($type)) {
                  case 2:
      Severity: Minor
      Found in class/Lists.php - About 1 hr to fix

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

            public static function uploadFiles(
                $FILES,
                $uploaddir = 'uploads',
                $allowed_mimetypes = '',
                $redirecturl = 'index.php',
        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 getServerStats has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function getServerStats()
                {
                    //mb    $wfdownloads = WfdownloadsWfdownloads::getInstance();
                    $moduleDirName      = \basename(dirname(__DIR__, 2));
                    $moduleDirNameUpper = mb_strtoupper($moduleDirName);
            Severity: Minor
            Found in class/Common/ServerStats.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 mix has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static function mix($a, $b, $c)
                    {
                        $a -= $b;
                        $a -= $c;
                        $a ^= static::fillZeroes($c, 13);
                Severity: Minor
                Found in class/Utility.php - About 1 hr to fix

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

                      public static function convertOrderByTrans($orderby)
                      {
                          if ('hits ASC' === $orderby) {
                              $orderbyTrans = _MD_WFL_POPULARITYLTOM;
                          }
                  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 createThumb has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function createThumb(
                          $img_width = null,
                          $img_height = null,
                          $img_quality = null,
                          $img_update = null,
                  Severity: Minor
                  Found in class/ThumbsNails.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 wflinks_notify_iteminfo has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function wflinks_notify_iteminfo($category, $item_id)
                  {
                      $moduleDirName = basename(dirname(__DIR__));
                      global $xoopsModule, $xoopsModuleConfig, $xoopsConfig;
                  
                  
                  Severity: Minor
                  Found in include/notification.inc.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 _loadAllChildItemIds has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function _loadAllChildItemIds($itemId, &$childIds)
                      {
                          if (!empty($this->_itemTree[$itemId]['children'])) {
                              $first_child = $this->_itemTree[$itemId]['children'];
                              foreach ($first_child as $fcid) {
                  Severity: Minor
                  Found in admin/mygrouppermform.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 uploadFiles has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function uploadFiles(
                          $FILES,
                          $uploaddir = 'uploads',
                          $allowed_mimetypes = '',
                          $redirecturl = 'index.php',
                  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 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 b_waiting_wflinks has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function b_waiting_wflinks()
                    {
                        $xoopsDB = \XoopsDatabaseFactory::getDatabaseConnection();
                        $ret     = [];
                    
                    
                    Severity: Minor
                    Found in EXTRA/htdocs/modules/waiting/plugins/wflinks.php - About 1 hr to fix

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

                      if (null !== $helper->getConfig('screenshot') && 1 == $helper->getConfig('screenshot')) {
                          $xoopsTpl->assign('shots_dir', $helper->getConfig('screenshots'));
                          $xoopsTpl->assign('shotwidth', $helper->getConfig('shotwidth'));
                          $xoopsTpl->assign('shotheight', $helper->getConfig('shotheight'));
                          $xoopsTpl->assign('show_screenshot', true);
                      Severity: Major
                      Found in index.php and 2 other locations - About 1 hr to fix
                      singlelink.php on lines 187..192
                      viewcat.php on lines 238..243

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

                      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 (null !== $helper->getConfig('screenshot') && 1 == $helper->getConfig('screenshot')) {
                          $xoopsTpl->assign('shots_dir', $helper->getConfig('screenshots'));
                          $xoopsTpl->assign('shotwidth', $helper->getConfig('shotwidth'));
                          $xoopsTpl->assign('shotheight', $helper->getConfig('shotheight'));
                          $xoopsTpl->assign('show_screenshot', true);
                      Severity: Major
                      Found in singlelink.php and 2 other locations - About 1 hr to fix
                      index.php on lines 133..138
                      viewcat.php on lines 238..243

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

                      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 (null !== $helper->getConfig('screenshot') && 1 == $helper->getConfig('screenshot')) {
                              $xoopsTpl->assign('shots_dir', $helper->getConfig('screenshots'));
                              $xoopsTpl->assign('shotwidth', $helper->getConfig('shotwidth'));
                              $xoopsTpl->assign('shotheight', $helper->getConfig('shotheight'));
                              $xoopsTpl->assign('show_screenshot', true);
                      Severity: Major
                      Found in viewcat.php and 2 other locations - About 1 hr to fix
                      index.php on lines 133..138
                      singlelink.php on lines 187..192

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

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

                              $postoffice = '',
                              $extended = '',
                              $street = '',
                              $city = '',
                              $region = '',
                      Severity: Major
                      Found in class/VCard.php - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language