mambax7/myconference

View on GitHub

Showing 478 of 478 total issues

Function xoops_module_update_myconference has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
Open

function xoops_module_update_myconference(\XoopsModule $module, $previousVersion = null)
{
    $moduleDirName = basename(dirname(__DIR__));
    $capsDirName   = 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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    case 'addtrack':
        $cid     = Request::getInt('cid', 0, 'POST');//$_POST['cid'];
        $title   = $myts->stripslashesGPC(trim(Request::getString('title', '', 'POST')));//$_POST['title']));
        $summary = $myts->stripslashesGPC(trim(Request::getString('summary', '', 'POST')));//$_POST['summary']));

Severity: Major
Found in admin/tracks.php and 1 other location - About 3 hrs to fix
admin/sections.php on lines 111..124

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

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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    case 'addsection':

        $cid     = Request::getInt('cid', 0, 'POST');//$cid     = (int)$_POST['cid'];
        $title   = $myts->stripslashesGPC(trim(Request::getString('title', '', 'POST'))); //$_POST['title']));
        $summary = $myts->stripslashesGPC(trim(Request::getText('summary', '', 'POST')));//$_POST['summary']));
Severity: Major
Found in admin/sections.php and 1 other location - About 3 hrs to fix
admin/tracks.php on lines 111..123

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

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

Function deleteDirectory has a Cognitive Complexity of 22 (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 3 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 getFile has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function getFile($file)
{
    require_once XOOPS_ROOT_PATH . '/class/uploader.php';
    $mimetypes = [
        'image/gif',
Severity: Major
Found in admin/conference.php - About 2 hrs to fix

    Method xoops_module_update_myconference has 56 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

      Function render has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          public function render()
          {
              $ret = '';
              //
              if (!$this->caseSensitive) {
      Severity: Minor
      Found in class/Common/choicebyletter.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 getConfig has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function getConfig()
      {
          $moduleDirName      = basename(dirname(__DIR__));
          $moduleDirNameUpper = strtoupper($moduleDirName);
          return (object)[
      Severity: Minor
      Found in include/config.php - About 1 hr to fix

        Method render has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function render()
            {
                $ret = '';
                //
                if (!$this->caseSensitive) {
        Severity: Minor
        Found in class/Common/choicebyletter.php - About 1 hr to fix

          Method createThumbs has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function createThumbs($filename)
              {/*
              require_once('phpthumb/phpthumb.class.php');
              $thumbnail_widths = array(150, 400);
              foreach ($thumbnail_widths as $thumbnail_width) {
          Severity: Minor
          Found in class/Utility.php - About 1 hr to fix

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

                public static function createThumbs($filename)
                {/*
                require_once('phpthumb/phpthumb.class.php');
                $thumbnail_widths = array(150, 400);
                foreach ($thumbnail_widths as $thumbnail_width) {
            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 imageSave has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

            function imageSave()
            {
                // Function that takes the data from the form and, in case of a
                // new image, uploads the file to the appropriate directory and
                // creates the record in the database; if it is an edit, the
            Severity: Minor
            Found in admin/images.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 makeMySelBox has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function makeMySelBox($title, $order = '', $preset_id = 0, $none = 0, $sel_name = '', $onchange = '')
                {
                    if ('' == $sel_name) {
                        $sel_name = $this->id;
                    }
            Severity: Minor
            Found in class/Common/xoopstree.php - About 1 hr to fix

              Function recurseCopy has a Cognitive Complexity of 12 (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 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 makeMySelBox has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function makeMySelBox($title, $order = '', $preset_id = 0, $none = 0, $sel_name = '', $onchange = '')
                  {
                      if ('' == $sel_name) {
                          $sel_name = $this->id;
                      }
              Severity: Minor
              Found in class/Common/xoopstree.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_myconference has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function xoops_module_install_myconference(\XoopsModule $module)
              {
                  require_once  __DIR__ . '/../../../mainfile.php';
                  require_once  __DIR__ . '/../include/config.php';
              
              
              Severity: Minor
              Found in include/oninstall.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 getServerStats has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static function getServerStats()
                    {
                        //mb    $wfdownloads = WfdownloadsWfdownloads::getInstance();
                        $moduleDirName      = basename(dirname(dirname(__DIR__)));
                        $moduleDirNameUpper = strtoupper($moduleDirName);
                Severity: Minor
                Found in class/Common/ServerStats.php - About 1 hr to fix

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

                      public static function lettersChoice($myObject, $activeObject, $criteria, $name, $link, $link2 = null)
                      {
                          /*
                          $pedigree = PedigreePedigree::getInstance();
                          xoops_load('XoopsLocal');
                  Severity: Minor
                  Found in class/Utility.php - About 1 hr to fix

                    Avoid using undefined variables such as '$xoopsDB' which will lead to PHP notices.
                    Open

                                if ($xoopsDB->query($sqlquery)) {
                    Severity: Minor
                    Found in admin/images.php by phpmd

                    UndefinedVariable

                    Since: 2.8.0

                    Detects when a variable is used that has not been defined before.

                    Example

                    class Foo
                    {
                        private function bar()
                        {
                            // $message is undefined
                            echo $message;
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#undefinedvariable

                    Severity
                    Category
                    Status
                    Source
                    Language