mambax7/smartobject

View on GitHub

Showing 646 of 1,188 total issues

Function create has 83 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    create: function (element) {
        element = $(element);
        var options = Object.extend({
            element: element,
            tag: 'li',       // assumes li children, override with tag: 'tagname'
Severity: Major
Found in include/projax_/js/dragdrop.js - About 3 hrs to fix

    Function create has 83 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        create: function (element) {
            element = $(element);
            var options = Object.extend({
                element: element,
                tag: 'li',       // assumes li children, override with tag: 'tagname'
    Severity: Major
    Found in include/scriptaculous/src/dragdrop.js - About 3 hrs to fix

      Function initialize has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          initialize: function (testcases) {
              this.options = Object.extend({
                  testLog: 'testlog'
              }, arguments[1] || {});
              this.options.resultsURL = this.parseResultsURLQueryParameter();
      Severity: Minor
      Found in include/scriptaculous/src/unittest.js - 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

      File img.php has 300 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
       * Image Creation script
       *
       * D.J.
      Severity: Minor
      Found in include/captcha/scripts/img.php - About 3 hrs to fix

        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

        File dtree.js has 292 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /*--------------------------------------------------|
        
         | dTree 2.05 | www.destroydrop.com/javascript/tree/ |
        
         |---------------------------------------------------|
        Severity: Minor
        Found in include/dtree.js - About 3 hrs to fix

          Method getControl has 74 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getControl($controlName, $key)
              {
                  switch ($controlName) {
                      case 'check':
          //                require_once SMARTOBJECT_ROOT_PATH . 'class/form/elements/smartformcheckelement.php';
          Severity: Major
          Found in class/Form/SmartObjectForm.php - About 2 hrs to fix

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

                public static function getLinkedUnameFromId($userid = 0, $name = 0, $users = [], $withContact = false)
                {
                    if (!is_numeric($userid)) {
                        return $userid;
                    }
            Severity: Minor
            Found in class/Utility.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 createTableRows has 71 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function createTableRows()
                {
                    $this->_aObjects = [];
            
                    $doWeHaveActions = false;
            Severity: Major
            Found in class/Table.php - About 2 hrs to fix

              Function addNode has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

              dTree.prototype.addNode = function (pNode) {
              
                  var str = '';
              
                  var n = 0;
              Severity: Minor
              Found in include/dtree.js - 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

              Function renderValidationJS has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function renderValidationJS($withtags = true)
                  {
                      $js = '';
                      if ($withtags) {
                          $js .= "\n<!-- Start Form Validation JavaScript //-->\n<script type='text/javascript'>\n<!--//\n";
              Severity: Minor
              Found in class/Form/SmartObjectForm.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

              File update.php has 281 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              
              /**
               *
               * Module: SmartSection
              Severity: Minor
              Found in admin/update.php - About 2 hrs to fix

                Method initCommonVar has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function initCommonVar($varname, $displayOnForm = true, $default = 'notdefined')
                    {
                        switch ($varname) {
                            case 'dohtml':
                                $value = 'notdefined' !== $default ? $default : true;
                Severity: Major
                Found in class/BaseSmartObject.php - About 2 hrs to fix

                  Method renderValidationJS has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function renderValidationJS($withtags = true)
                      {
                          $js = '';
                          if ($withtags) {
                              $js .= "\n<!-- Start Form Validation JavaScript //-->\n<script type='text/javascript'>\n<!--//\n";
                  Severity: Major
                  Found in class/Form/SmartObjectForm.php - About 2 hrs to fix

                    Method createTableRow has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function createTableRow($object, $level = 0)
                        {
                            $aObject = [];
                    
                            $i = 0;
                    Severity: Major
                    Found in class/TreeTable.php - About 2 hrs to fix

                      Function getPlayerVersion has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                      Open

                      deconcept.SWFObjectUtil.getPlayerVersion = function () {
                          var _23 = new deconcept.PlayerVersion([0, 0, 0]);
                          if (navigator.plugins && navigator.mimeTypes.length) {
                              var x = navigator.plugins["Shockwave Flash"];
                              if (x && x.description) {
                      Severity: Minor
                      Found in include/swfobject.js - 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 postDataToObject has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function postDataToObject(&$smartObj)
                          {
                              foreach (array_keys($smartObj->vars) as $key) {
                                  switch ($smartObj->vars[$key]['data_type']) {
                                      case XOBJ_DTYPE_IMAGE:
                      Severity: Major
                      Found in class/ObjectController.php - About 2 hrs to fix

                        prototype has 23 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        Autocompleter.Base.prototype = {
                            baseInitialize: function (element, update, options) {
                                this.element = $(element);
                                this.update = $(update);
                                this.hasFocus = false;
                        Severity: Minor
                        Found in include/projax_/js/controls.js - About 2 hrs to fix

                          prototype has 23 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          Autocompleter.Base.prototype = {
                              baseInitialize: function (element, update, options) {
                                  this.element = $(element);
                                  this.update = $(update);
                                  this.hasFocus = false;
                          Severity: Minor
                          Found in include/projax/js/controls.js - About 2 hrs to fix

                            prototype has 23 functions (exceeds 20 allowed). Consider refactoring.
                            Open

                            Autocompleter.Base.prototype = {
                                baseInitialize: function (element, update, options) {
                                    this.element = $(element);
                                    this.update = $(update);
                                    this.hasFocus = false;
                            Severity: Minor
                            Found in include/scriptaculous/src/controls.js - About 2 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language