modxcms/revolution

View on GitHub

Showing 7,873 of 7,873 total issues

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

    public function getValidator() {
        if (!is_object($this->_validator)) {
            $validatorClass = $this->xpdo->loadClass('validation.xPDOValidator', XPDO_CORE_PATH, true, true);
            if ($derivedClass = $this->getOption(xPDO::OPT_VALIDATOR_CLASS, null, '')) {
                if ($derivedClass = $this->xpdo->loadClass($derivedClass, '', false, true)) {
Severity: Minor
Found in core/xpdo/om/xpdoobject.class.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 (is_string($value)) {
                                $value= unserialize($value);
                            }
Severity: Major
Found in core/xpdo/om/xpdoobject.class.php - About 45 mins to fix

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

        public function removeObjectContainer($className) {
            $removed= false;
            if ($this->xpdo->getConnection(array(xPDO::OPT_CONN_MUTABLE => true))) {
                $instance= $this->xpdo->newObject($className);
                if ($instance) {
    Severity: Minor
    Found in core/xpdo/om/sqlite/xpdomanager.class.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 (!empty($foreignCriteria)) {
                                $conditions = array($foreignCriteria, $conditions);
                            }
    Severity: Major
    Found in core/xpdo/om/xpdoquery.class.php - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                                  if (is_string($format) && !empty ($format)) {
                                      if (strpos($format, 're:') === 0) {
                                          if (!empty ($formatTemplate) && is_string($formatTemplate)) {
                                              $value= preg_replace(substr($format, 3), $formatTemplate, $value);
                                          }
      Severity: Major
      Found in core/xpdo/om/xpdoobject.class.php - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                        if (in_array($childPK, $ancestors[$composite['class']])) {
                                            continue;
                                        }
        Severity: Major
        Found in core/xpdo/om/xpdoobject.class.php - About 45 mins to fix

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

              public function removeField($class, $name, array $options = array()) {
                  $result = false;
                  if ($this->xpdo->getConnection(array(xPDO::OPT_CONN_MUTABLE => true))) {
                      $className = $this->xpdo->loadClass($class);
                      if ($className) {
          Severity: Minor
          Found in core/xpdo/om/mysql/xpdomanager.class.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 (is_array($fkMeta['criteria']['foreign'])) {
                                      foreach ($fkMeta['criteria']['foreign'] as $critKey => $critVal) {
                                          if (is_numeric($critKey)) {
                                              $foreignCriteria[] = $critVal;
                                          } else {
          Severity: Major
          Found in core/xpdo/om/xpdoquery.class.php - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                        if ($ts !== false && !empty($value)) {
                                            if (is_string($format) && !empty ($format)) {
                                                if (strpos($format, 're:') === 0) {
                                                    $value= date('Y-m-d', $ts);
                                                    if (!empty ($formatTemplate) && is_string($formatTemplate)) {
            Severity: Major
            Found in core/xpdo/om/xpdoobject.class.php - About 45 mins to fix

              Method getSelectColumns has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public static function getSelectColumns(xPDO & $xpdo, $className, $tableAlias= '', $columnPrefix= '', $columns= array (), $exclude= false) {
              Severity: Minor
              Found in core/xpdo/om/xpdoobject.class.php - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                            if (is_string($format) && !empty ($format)) {
                                                if (strpos($format, 're:') === 0) {
                                                    if (!empty ($formatTemplate) && is_string($formatTemplate)) {
                                                        $value= preg_replace(substr($format, 3), $formatTemplate, $value);
                                                    }
                Severity: Major
                Found in core/xpdo/om/xpdoobject.class.php - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if ($pkGenerated) {
                                              $this->_fields[$this->getPK()]= $this->xpdo->lastInsertId();
                                          }
                  Severity: Major
                  Found in core/xpdo/om/xpdoobject.class.php - About 45 mins to fix

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

                        public function removeIndex($class, $name, array $options = array()) {
                            $result = false;
                            if ($this->xpdo->getConnection(array(xPDO::OPT_CONN_MUTABLE => true))) {
                                $className = $this->xpdo->loadClass($class);
                                if ($className) {
                    Severity: Minor
                    Found in core/xpdo/om/mysql/xpdomanager.class.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 (is_array($childPK)) {
                                                        $childPK = implode('|', $childPK);
                                                    }
                    Severity: Major
                    Found in core/xpdo/om/xpdoobject.class.php - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                                  if (!empty($indexset)) {
                                                      switch ($indexType) {
                                                          case 'UNIQUE':
                                                              $createIndices[$indexkey] = "CREATE UNIQUE INDEX {$this->xpdo->escape($indexkey)} ON {$tableName} ({$indexset})";
                                                              break;
                      Severity: Major
                      Found in core/xpdo/om/sqlite/xpdomanager.class.php - About 45 mins to fix

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

                            public function process() {
                                $language = 'en';
                                $namespace = 'core';
                                $corePath = $this->modx->getOption('core_path',null,MODX_CORE_PATH);
                        
                        
                        Severity: Minor
                        Found in core/model/modx/processors/workspace/lexicon/reloadfrombase.class.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

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

                          function privAddFileUsingTempFile($p_filedescr, &$p_header, &$p_options)
                          {
                            $v_result=PCLZIP_ERR_NO_ERROR;
                        
                            // ----- Working variable
                        Severity: Minor
                        Found in core/xpdo/compression/pclzip.lib.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

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

                            public function process() {
                                $dashboards = $this->getProperty('dashboards',null);
                        
                                if (empty($dashboards)) {
                                    return $this->failure($this->modx->lexicon('dashboard_err_ns'));
                        Severity: Minor
                        Found in core/model/modx/processors/system/dashboard/removemultiple.class.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

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

                            public function process() {
                                $widgets = $this->getProperty('widgets',null);
                        
                                if (empty($widgets)) {
                                    return $this->failure($this->modx->lexicon('widget_err_ns'));

                        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 beforeSet has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function beforeSet() {
                                /* default settings */
                                $this->prepareParent();
                                if ($this->getProperty('parent') === (int) $this->modx->getOption('tree_root_id') && !$this->modx->hasPermission('new_document_in_root')) {
                                    return $this->modx->lexicon('permission_denied');
                        Severity: Minor
                        Found in core/model/modx/processors/resource/create.class.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

                        Severity
                        Category
                        Status
                        Source
                        Language