XoopsModules25x/about

View on GitHub

Showing 434 of 434 total issues

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

    public function getBread(array $pages = [], $key = 0)
    {
        if (!\is_array($pages) || 0 === \count($pages)) {
            return false;
        }
Severity: Minor
Found in class/PageHandler.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_update_about has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function xoops_module_update_about(\XoopsModule $module, $prev_version = null)
{
    $success = true;
    // Delete files from previous version (if they exist)
    $oldFiles = [
Severity: Minor
Found in include/action.module.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

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

    function xoops_module_install_about(\XoopsModule $module)
    {
        require_once dirname(__DIR__, 3) . '/mainfile.php';
    
        $moduleDirName = basename(dirname(__DIR__));
    Severity: Minor
    Found in include/oninstall.php - About 1 hr to fix

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

          public static function getServerStats()
          {
              $moduleDirName      = \basename(dirname(__DIR__, 2));
              $moduleDirNameUpper = mb_strtoupper($moduleDirName);
              \xoops_loadLanguage('common', $moduleDirName);
      Severity: Minor
      Found in class/Common/ServerStats.php - About 1 hr to fix

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

        function xoops_module_install_about(\XoopsModule $module)
        {
            $success   = true;
            $data_file = XOOPS_ROOT_PATH . '/modules/about/sql/mysql.about.sql';
            $GLOBALS['xoopsDB']->queryF('SET NAMES utf8');
        Severity: Minor
        Found in include/action.module.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_about has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function xoops_module_install_about(\XoopsModule $module)
        {
            $success   = true;
            $data_file = XOOPS_ROOT_PATH . '/modules/about/sql/mysql.about.sql';
            $GLOBALS['xoopsDB']->queryF('SET NAMES utf8');
        Severity: Minor
        Found in include/action.module.php - About 1 hr to fix

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

          function about_block_page_edit($options)
          {
              $moduleDirName = basename(dirname(__DIR__));
              $helper       = Helper::getInstance();
              $options_page = [];
          Severity: Minor
          Found in blocks/blocks.php - About 1 hr to fix

            Each class must be in a namespace of at least one level (a top-level vendor name)
            Open

            class AboutCorePreload extends \XoopsPreloadItem
            Severity: Minor
            Found in preloads/core.php by phpcodesniffer

            Function recurseCopy has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function recurseCopy($src, $dst)
                {
                    $dir = \opendir($src);
                    //        @mkdir($dst);
                    if (!@\mkdir($dst) && !\is_dir($dst)) {
            Severity: Minor
            Found in class/Common/FilesManagement.php - About 55 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 rcopy has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function rcopy($src, $dest)
                {
                    // 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 55 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 rmove has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function rmove($src, $dest)
                {
                    // 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 55 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

            Method makeSelBox has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                        $name,
                        $fieldName,
                        $prefix = '-',
                        $selected = '',
                        $addEmptyOption = false,
            Severity: Major
            Found in class/Tree.php - About 50 mins to fix

              The parameter $prev_version is not named in camelCase.
              Open

              function xoops_module_update_about(\XoopsModule $module, $prev_version = null)
              {
                  $success = true;
                  // Delete files from previous version (if they exist)
                  $oldFiles = [
              Severity: Minor
              Found in include/action.module.php by phpmd

              CamelCaseParameterName

              Since: 0.2

              It is considered best practice to use the camelCase notation to name parameters.

              Example

              class ClassName {
                  public function doSomething($user_name) {
                  }
              }

              Source

              The parameter $prefix_orig is not named in camelCase.
              Open

                      public function makeTreeItems($key, &$ret, $prefix_orig, $prefix_curr = '', $tags = null)
                      {
                          if ($key > 0) {
                              if ($tags && \is_array($tags)) {
                                  foreach ($tags as $tag) {
              Severity: Minor
              Found in class/Tree.php by phpmd

              CamelCaseParameterName

              Since: 0.2

              It is considered best practice to use the camelCase notation to name parameters.

              Example

              class ClassName {
                  public function doSomething($user_name) {
                  }
              }

              Source

              Avoid variables with short names like $db. Configured minimum length is 3.
              Open

                      $db     = \XoopsDatabaseFactory::getDatabaseConnection();
              Severity: Minor
              Found in class/Helper.php by phpmd

              ShortVariable

              Since: 0.2

              Detects when a field, local, or parameter has a very short name.

              Example

              class Something {
                  private $q = 15; // VIOLATION - Field
                  public static function main( array $as ) { // VIOLATION - Formal
                      $r = 20 + $this->q; // VIOLATION - Local
                      for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                          $r += $this->q;
                      }
                  }
              }

              Source https://phpmd.org/rules/naming.html#shortvariable

              The parameter $prefix_curr is not named in camelCase.
              Open

                      public function makeTreeItems($key, &$ret, $prefix_orig, $prefix_curr = '', $tags = null)
                      {
                          if ($key > 0) {
                              if ($tags && \is_array($tags)) {
                                  foreach ($tags as $tag) {
              Severity: Minor
              Found in class/Tree.php by phpmd

              CamelCaseParameterName

              Since: 0.2

              It is considered best practice to use the camelCase notation to name parameters.

              Example

              class ClassName {
                  public function doSomething($user_name) {
                  }
              }

              Source

              The parameter $id_field is not named in camelCase.
              Open

                  public static function cloneRecord($tableName, $id_field, $id)
                  {
                      $new_id = false;
                      $table  = $GLOBALS['xoopsDB']->prefix($tableName);
                      // copy content of the record you wish to clone
              Severity: Minor
              Found in class/Common/SysUtility.php by phpmd

              CamelCaseParameterName

              Since: 0.2

              It is considered best practice to use the camelCase notation to name parameters.

              Example

              class ClassName {
                  public function doSomething($user_name) {
                  }
              }

              Source

              Avoid variables with short names like $id. Configured minimum length is 3.
              Open

                  public static function cloneRecord($tableName, $id_field, $id)
              Severity: Minor
              Found in class/Common/SysUtility.php by phpmd

              ShortVariable

              Since: 0.2

              Detects when a field, local, or parameter has a very short name.

              Example

              class Something {
                  private $q = 15; // VIOLATION - Field
                  public static function main( array $as ) { // VIOLATION - Formal
                      $r = 20 + $this->q; // VIOLATION - Local
                      for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                          $r += $this->q;
                      }
                  }
              }

              Source https://phpmd.org/rules/naming.html#shortvariable

              Avoid variables with short names like $db. Configured minimum length is 3.
              Open

                  public function __construct(\XoopsDatabase $db = null)
              Severity: Minor
              Found in class/PageHandler.php by phpmd

              ShortVariable

              Since: 0.2

              Detects when a field, local, or parameter has a very short name.

              Example

              class Something {
                  private $q = 15; // VIOLATION - Field
                  public static function main( array $as ) { // VIOLATION - Formal
                      $r = 20 + $this->q; // VIOLATION - Local
                      for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                          $r += $this->q;
                      }
                  }
              }

              Source https://phpmd.org/rules/naming.html#shortvariable

              Severity
              Category
              Status
              Source
              Language