modxcms/revolution

View on GitHub

Showing 7,873 of 7,873 total issues

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

    public function setOptions($ch,array $options = array()) {
        /* always return us the result */
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, !empty($options['curlopt_returntransfer']) ? $options['curlopt_returntransfer'] : 1);
        /* we dont want header gruft */
        curl_setopt($ch, CURLOPT_HEADER, !empty($options['curlopt_header']) ? $options['curlopt_header'] : 0);
Severity: Minor
Found in core/model/modx/rest/modrestcurlclient.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 (!$isAbsolute) {
                            $value = $source->prepareOutputUrl($value);
                        }
Severity: Major
Found in core/model/modx/modtemplatevar.class.php - About 45 mins to fix

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

        public function getRender($params,$value,array $paths,$method,$resourceId = 0,$type = 'text') {
    Severity: Minor
    Found in core/model/modx/modtemplatevar.class.php - About 45 mins to fix

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

          public function _parse($result) {
              $headers = array();
              $httpVer = strtok($result, "\n");
      
              while($line = strtok("\n")){
      Severity: Minor
      Found in core/model/modx/rest/modrest.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 outputContent has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function outputContent(array $options = array()) {
              $route = $this->modx->request->action;
              $this->namespace = $this->modx->request->namespace;
              if (empty($route)) {
                  $route = $this->namespace == 'core' ? 'welcome' : 'index';
      Severity: Minor
      Found in core/model/modx/modmanagerresponse.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 (!$isForward || ($isForward && !$this->modx->getOption('allow_forward_across_contexts', $options, false))) {
                                  if (!$this->modx->getCount('modContextResource', array($this->modx->context->get('key'), $resourceId))) {
                                      return null;
                                  }
                              }
      Severity: Major
      Found in core/model/modx/modrequest.class.php - About 45 mins to fix

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

            protected function _log($level, $msg, $target= '', $def= '', $file= '', $line= '') {
        Severity: Minor
        Found in core/model/modx/modx.class.php - About 45 mins to fix

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

              public function sendError($type = '', $options = array()) {
                  if (!is_string($type) || empty($type)) $type = $this->getOption('error_type', $options, 'unavailable');
                  while (ob_get_level() && @ob_end_clean()) {}
                  if (!XPDO_CLI_MODE) {
                      $errorPageTitle = $this->getOption('error_pagetitle', $options, 'Error 503: Service temporarily unavailable');
          Severity: Minor
          Found in core/model/modx/modx.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 ($resource) {
                                      $this->_output = $resource;
                                  }
          Severity: Major
          Found in core/model/modx/modparser.class.php - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if (array_key_exists('use_weblink_target', $this->_properties)) {
                                        $options['use_weblink_target'] = $this->_properties['use_weblink_target'];
                                        unset($this->_properties['use_weblink_target']);
                                    }
            Severity: Major
            Found in core/model/modx/modparser.class.php - About 45 mins to fix

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

                  public function regClientStartupScript($src, $plaintext= false) {
                      if (!empty ($src) && !array_key_exists($src, $this->loadedjscripts)) {
                          if (isset ($this->loadedjscripts[$src]))
                              return;
                          $this->loadedjscripts[$src]= true;
              Severity: Minor
              Found in core/model/modx/modx.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 checkValidation has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function checkValidation($objs= array()) {
                      if (is_object($objs)) {
                          $this->addObjectToValidate($objs);
                      }
                      else if (is_array($objs) && !empty($objs)) {
              Severity: Minor
              Found in core/model/modx/error/moderror.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

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

                  public static function listEvents(xPDO &$xpdo, $plugin, array $criteria = array(), array $sort = array('id' => 'ASC'), $limit = 0, $offset = 0) {
              Severity: Minor
              Found in core/model/modx/mysql/modevent.class.php - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if (array_key_exists('scheme', $this->_properties)) {
                                            $scheme = $this->_properties['scheme'];
                                            unset($this->_properties['scheme']);
                                            if (is_numeric($scheme)) $scheme = (integer) $scheme;
                                        }
                Severity: Major
                Found in core/model/modx/modparser.class.php - About 45 mins to fix

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

                      public function removeExtensionPackage($name) {
                          /** @var modSystemSetting $setting */
                          $setting = $this->getObject('modSystemSetting',array(
                              'key' => 'extension_packages',
                          ));
                  Severity: Minor
                  Found in core/model/modx/modx.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 (array_key_exists('context', $this->_properties)) {
                                              $context = $this->_properties['context'];
                                              unset($this->_properties['context']);
                                          }
                  Severity: Major
                  Found in core/model/modx/modparser.class.php - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                                if (in_array($propertyKey, array('context', 'scheme', 'use_weblink_target'))) continue;
                    Severity: Major
                    Found in core/model/modx/modparser.class.php - About 45 mins to fix

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

                          public static function getValidMessages(modDbRegister &$register, $topic, $topicBase, $topicMsg, $limit, array $options = array()) {
                      Severity: Minor
                      Found in core/model/modx/registry/db/sqlsrv/moddbregistermessage.class.php - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                                if ($applicablePolicy['principal'] == $principalId) {
                                                                    if ($principalAuthority <= $applicablePolicy['authority']) {
                                                                        if (!$applicablePolicy['policy']) {
                                                                            return true;
                                                                        }
                        Severity: Major
                        Found in core/model/modx/modaccessibleobject.class.php - About 45 mins to fix

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

                              public function initialize() {
                                  $primaryKey = $this->getProperty($this->primaryKeyField, false);
                                  if (empty($primaryKey)) {
                                      return $this->modx->lexicon($this->objectType . '_err_ns');
                                  }
                          Severity: Minor
                          Found in core/model/modx/modprocessor.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