XoopsModules25x/xoopspartners

View on GitHub

Showing 25 of 346 total issues

Function xoops_module_update_xoopspartners has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
Open

function xoops_module_update_xoopspartners(\XoopsModule $module, $previousVersion = null)
{
    $moduleDirName      = basename(dirname(__DIR__));
    $moduleDirNameUpper = mb_strtoupper($moduleDirName);

Severity: Minor
Found in include/onupdate.php - About 1 day 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 truncateHtml has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
Open

    public static function truncateHtml($text, $length = 100, $ending = '...', $exact = false, $considerHtml = true)
    {
        if ($considerHtml) {
            // if the plain text is shorter than the maximum length, return the whole text
            if (mb_strlen(\preg_replace('/<.*?' . '>/', '', $text)) <= $length) {
Severity: Minor
Found in class/Common/SysUtility.php - About 1 day 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 b_xoopspartners_edit has 117 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function b_xoopspartners_edit($options)
{
    if (0 == $options[0]) { //put spaces between partners
        $chk0no  = ' checked';
        $chk0yes = '';
Severity: Major
Found in blocks/partners.php - About 4 hrs to fix

    File main.php has 345 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /*
     * You may not change or alter any portion of this comment or credits of
     * supporting developers from this source code or any supporting source code
     * which is considered copyrighted (c) material of the original comment or credit
    Severity: Minor
    Found in admin/main.php - About 4 hrs to fix

      Function checkVerModule has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function checkVerModule($helper, $source = 'github', $default = 'master')
          {
              $moduleDirName      = \basename(\dirname(\dirname(__DIR__)));
              $moduleDirNameUpper = mb_strtoupper($moduleDirName);
              $update             = '';
      Severity: Minor
      Found in class/Common/VersionChecks.php - About 2 hrs 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_xoopspartners has 67 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function xoops_module_update_xoopspartners(\XoopsModule $module, $previousVersion = null)
      {
          $moduleDirName      = basename(dirname(__DIR__));
          $moduleDirNameUpper = mb_strtoupper($moduleDirName);
      
      
      Severity: Major
      Found in include/onupdate.php - About 2 hrs to fix

        Method truncateHtml has 63 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function truncateHtml($text, $length = 100, $ending = '...', $exact = false, $considerHtml = true)
            {
                if ($considerHtml) {
                    // if the plain text is shorter than the maximum length, return the whole text
                    if (mb_strlen(\preg_replace('/<.*?' . '>/', '', $text)) <= $length) {
        Severity: Major
        Found in class/Common/SysUtility.php - About 2 hrs to fix

          Function deleteDirectory has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function deleteDirectory($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 2 hrs 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 b_xoopspartners_show has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function b_xoopspartners_show($options)
          {
              $myts = \MyTextSanitizer::getInstance();
          
              $moduleDirName = basename(dirname(__DIR__));
          Severity: Minor
          Found in blocks/partners.php - About 1 hr to fix

            Method checkVerModule has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function checkVerModule($helper, $source = 'github', $default = 'master')
                {
                    $moduleDirName      = \basename(\dirname(\dirname(__DIR__)));
                    $moduleDirNameUpper = mb_strtoupper($moduleDirName);
                    $update             = '';
            Severity: Minor
            Found in class/Common/VersionChecks.php - About 1 hr to fix

              Function b_xoopspartners_show has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

              function b_xoopspartners_show($options)
              {
                  $myts = \MyTextSanitizer::getInstance();
              
                  $moduleDirName = basename(dirname(__DIR__));
              Severity: Minor
              Found in blocks/partners.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 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_xoopspartners has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function xoops_module_install_xoopspartners(\XoopsModule $module)
              {
                  require_once dirname(dirname(dirname(__DIR__))) . '/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()
                    {
                        //mb    $wfdownloads = WfdownloadsWfdownloads::getInstance();
                        $moduleDirName      = \basename(\dirname(\dirname(__DIR__)));
                        $moduleDirNameUpper = mb_strtoupper($moduleDirName);
                Severity: Minor
                Found in class/Common/ServerStats.php - About 1 hr to fix

                  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

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

                  Avoid deeply nested control flow statements.
                  Open

                                          if ($uploader->upload()) {
                                              $image = $uploader->getSavedFileName();  // get file name to save in db
                                          }
                  Severity: Major
                  Found in join.php - About 45 mins to fix

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

                    function loadSampleData()
                    {
                        global $xoopsConfig;
                    
                        $moduleDirName = basename(dirname(__DIR__));
                    Severity: Minor
                    Found in testdata/index.php - About 45 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 deeply nested control flow statements.
                    Open

                                                if (file_exists($templateFolder . $v)) {
                                                    unlink($templateFolder . $v);
                                                }
                    Severity: Major
                    Found in include/onupdate.php - About 45 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language