XoopsModules25x/wfdownloads

View on GitHub

Showing 279 of 279 total issues

Function getEditor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getEditor($helper = null, $options = null)
    {
        /** @var Helper $helper */
        if (null === $options) {
            $options           = [];
Severity: Minor
Found in class/Common/SysUtility.php - About 35 mins 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 get_table_info has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function get_table_info($table, $default_fields)
{
    $result = $GLOBALS['xoopsDB']->query('SHOW COLUMNS FROM ' . $table);
    while (false !== ($existing_field = $GLOBALS['xoopsDB']->fetchArray($result))) {
        $fields[$existing_field['Field']] = $existing_field['Type'];
Severity: Minor
Found in include/onupdate.php - About 35 mins 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 getDir has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getDir($path = '.', $level = 0)
    {
        $ret    = [];
        $ignore = ['cgi-bin', '.', '..'];
        // Directories to ignore when listing output. Many hosts will deny PHP access to the cgi-bin.
Severity: Minor
Found in class/Utility.php - About 35 mins 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 getFiles has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getFiles($path = '.')
    {
        $files = [];
        $dir   = \opendir($path);
        while (false !== ($file = \readdir($dir))) {
Severity: Minor
Found in class/Utility.php - About 35 mins 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 makeDir has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function makeDir($dir, $perm = 0777, $create_index = true)
    {
        if (!\mkdir($dir, $perm) && !\is_dir($dir)) {
            throw new \RuntimeException('The directory ' . $dir . ' could not be created.');
        }
Severity: Minor
Found in class/Utility.php - About 35 mins 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 update_permissions_to_323 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function update_permissions_to_323(XoopsModule $module)
{
    /** @var \XoopsGroupPermHandler $grouppermHandler */
    $grouppermHandler = xoops_getHandler('groupperm');
    /** @var Wfdownloads\CategoryHandler $categoriesHandler */
Severity: Minor
Found in include/onupdate.php - About 35 mins 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 getDirectoryStatus has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getDirectoryStatus($path, $mode = 0777, $redirectFile = null)
    {
        global $pathIcon16;

        if (empty($path)) {
Severity: Minor
Found in class/Common/DirectoryChecker.php - About 35 mins 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 delete has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function delete(\XoopsObject $download, $force = false)
    {
        if (parent::delete($download, $force)) {
            $criteria = new \Criteria('lid', (int)$download->getVar('lid'));
            $this->helper->getHandler('Rating')->deleteAll($criteria);
Severity: Minor
Found in class/DownloadHandler.php - About 35 mins 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

Avoid too many return statements within this function.
Open

            return!1
Severity: Major
Found in assets/js/magnific/jquery.magnific-popup.min.js - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

        return true;
    Severity: Major
    Found in admin/clone.php - About 30 mins to fix

      Function loadSampleData has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function loadSampleData()
      {
          global $xoopsConfig;
          $moduleDirName      = basename(dirname(__DIR__));
          $moduleDirNameUpper = mb_strtoupper($moduleDirName);
      Severity: Minor
      Found in testdata/index.php - About 25 mins 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 sortCategories has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function sortCategories($pid = 0, $level = 0)
          {
              $helper = Helper::getInstance();
      
              $sorted   = [];
      Severity: Minor
      Found in class/Utility.php - About 25 mins 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 wfdownloads_notify_iteminfo has a Cognitive Complexity of 6 (exceeds 5 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 25 mins 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 xoops_module_install_wfdownloads has a Cognitive Complexity of 6 (exceeds 5 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 25 mins 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 generateSeoUrl has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function generateSeoUrl($op, $id, $title = '')
          {
              if (\defined('SEO_ENABLED')) {
                  if (SEO_ENABLED === 'rewrite') {
                      // generate SEO url using htaccess
      Severity: Minor
      Found in class/Utility.php - About 25 mins 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 convertIPAddresses has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          private function convertIPAddresses($tableName, $columnName)
          {
              if ($this->tableHandler->useTable($tableName)) {
                  $attributes = $this->tableHandler->getColumnAttributes($tableName, $columnName);
                  if (false !== mb_strpos($attributes, ' int(')) {
      Severity: Minor
      Found in class/Migrate.php - About 25 mins 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 sizeToBytes1024 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function sizeToBytes1024($size)
          {
              $l   = mb_substr($size, -1);
              $ret = mb_substr($size, 0, -1);
              switch (mb_strtoupper($l)) {
      Severity: Minor
      Found in class/Utility.php - About 25 mins 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 lettersChoice has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function lettersChoice()
          {
              $helper = Helper::getInstance();
      
              $criteria = $helper->getHandler('Download')->getActiveCriteria();
      Severity: Minor
      Found in class/Utility.php - About 25 mins 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 convertIPAddresses has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          private function convertIPAddresses($tableName, $columnName)
          {
              if ($this->tableHandler->useTable($tableName)) {
                  $attributes = $this->tableHandler->getColumnAttributes($tableName, $columnName);
                  if (false !== mb_strpos($attributes, ' int(')) {
      Severity: Minor
      Found in class/Common/Migrate.php - About 25 mins 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

      Severity
      Category
      Status
      Source
      Language