mambax7/smartobject

View on GitHub

Showing 646 of 1,188 total issues

Function createTableRow has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    public function createTableRow($object, $level = 0)
    {
        $aObject = [];

        $i = 0;
Severity: Minor
Found in class/TreeTable.php - About 4 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

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

Test.Unit.Assertions.prototype = {
    initialize: function () {
        this.assertions = 0;
        this.failures = 0;
        this.errors = 0;
Severity: Minor
Found in include/scriptaculous/src/unittest.js - About 4 hrs to fix

    Method createElements has 100 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function createElements()
        {
            $controls = $this->targetObject->controls;
            $vars     = $this->targetObject->vars;
            foreach ($vars as $key => $var) {
    Severity: Major
    Found in class/Form/SmartObjectForm.php - About 4 hrs to fix

      PersistableObjectHandler has 31 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class PersistableObjectHandler extends \XoopsObjectHandler
      {
          public $_itemname;
      
          /**
      Severity: Minor
      Found in class/PersistableObjectHandler.php - About 3 hrs to fix

        Function addto has 94 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function addto(addsite, AddURL, AddTitle) {
            var AddURL = AddURL;
            var AddTitle = AddTitle;
            switch (addsite) {
                case 0: //  AddToBookmarks.com ID:0 - an educational page on what Social Bookmarking is
        Severity: Major
        Found in include/addto/addto-multi.js - About 3 hrs to fix

          Method generateSeoTitle has 93 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function generateSeoTitle($title = '', $withExt = true)
              {
                  // Transformation de la chaine en minuscule
                  // Codage de la chaine afin d'éviter les erreurs 500 en cas de caractères imprévus
                  $title = rawurlencode(strtolower($title));
          Severity: Major
          Found in class/MetaGen.php - About 3 hrs to fix

            Prototype has 30 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class Prototype extends JavaScript
            {
                public $CALLBACKS = [
                    'uninitialized',
                    'loading',
            Severity: Minor
            Found in include/projax_/classes/Prototype.php - About 3 hrs to fix

              Prototype has 30 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class Prototype extends JavaScript
              {
                  public $CALLBACKS = [
                      'uninitialized',
                      'loading',
              Severity: Minor
              Found in include/projax/classes/Prototype.php - About 3 hrs to fix

                Method addAndActivateUser has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function addAndActivateUser($userObj, $groups = false, $notifyUser = true, &$password = false)
                    {
                        $email = $userObj->getVar('email');
                        if (!$userObj->getVar('email') || '' === $email) {
                            $userObj->setErrors(_CO_SOBJECT_USER_NEED_EMAIL);
                Severity: Major
                Found in class/MemberHandler.php - About 3 hrs to fix

                  Method generateTag has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function generateTag()
                      {
                          $title = rawurlencode(strtolower($this->getVar('description', 'e')));
                          $title = xoops_substr($title, 0, 10, '');
                          // Transformation des ponctuations
                  Severity: Major
                  Found in class/Customtag.php - About 3 hrs to fix

                    Method generateTag has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function generateTag()
                        {
                            $title = rawurlencode(strtolower($this->getVar('description', 'e')));
                            $title = xoops_substr($title, 0, 10, '');
                            // Transformation des ponctuations
                    Severity: Major
                    Found in class/Adsense.php - About 3 hrs to fix

                      Function Grow has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      Effect.Grow = function (element) {
                          element = $(element);
                          var options = Object.extend({
                              direction: 'center',
                              moveTransition: Effect.Transitions.sinoidal,
                      Severity: Major
                      Found in include/projax_/js/effects.js - About 3 hrs to fix

                        Function Grow has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        Effect.Grow = function (element) {
                            element = $(element);
                            var options = Object.extend({
                                direction: 'center',
                                moveTransition: Effect.Transitions.sinoidal,
                        Severity: Major
                        Found in include/projax/js/effects.js - About 3 hrs to fix

                          Function Grow has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          Effect.Grow = function (element) {
                              element = $(element);
                              var options = Object.extend({
                                  direction: 'center',
                                  moveTransition: Effect.Transitions.sinoidal,
                          Severity: Major
                          Found in include/scriptaculous/src/effects.js - About 3 hrs to fix

                            Function getStyle has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                            Open

                                getStyle: function (element, style) {
                                    element = $(element);
                                    if (['float', 'cssFloat'].include(style))
                                        style = (typeof element.style.styleFloat != 'undefined' ? 'styleFloat' : 'cssFloat');
                                    style = style.camelize();
                            Severity: Minor
                            Found in include/projax_/js/prototype.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

                            Function getStyle has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                            Open

                                getStyle: function (element, style) {
                                    element = $(element);
                                    if (['float', 'cssFloat'].include(style))
                                        style = (typeof element.style.styleFloat != 'undefined' ? 'styleFloat' : 'cssFloat');
                                    style = style.camelize();
                            Severity: Minor
                            Found in include/projax/js/prototype.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

                            Function getControl has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function getControl($controlName, $key)
                                {
                                    switch ($controlName) {
                                        case 'check':
                            //                require_once SMARTOBJECT_ROOT_PATH . 'class/form/elements/smartformcheckelement.php';
                            Severity: Minor
                            Found in class/Form/SmartObjectForm.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 getTextArea has 85 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function getTextArea($key)
                                {
                                    $var = $this->targetObject->vars[$key];
                            
                                    // if no control has been created, let's create a default one
                            Severity: Major
                            Found in class/Form/SmartObjectForm.php - About 3 hrs to fix

                              DbTable has 28 functions (exceeds 20 allowed). Consider refactoring.
                              Open

                              class DbTable
                              {
                                  /**
                                   * @var string $_name name of the table
                                   */
                              Severity: Minor
                              Found in class/DbTable.php - 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/projax/js/dragdrop.js - About 3 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language