modxcms/revolution

View on GitHub

Showing 7,873 of 7,873 total issues

Avoid deeply nested control flow statements.
Open

                        if ($qs= implode('&', $qs)) {
                            $qs= rawurlencode($qs);
                            $qs= str_replace(array('%26','%3D'),array('&','='),$qs);
                        }
Severity: Major
Found in core/model/modx/modparser.class.php - About 45 mins to fix

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

        public function isMember($groups, $matchAll = false) {
            $isMember = false;
            $resourceGroupNames = $this->getResourceGroupNames();
    
            if ($resourceGroupNames) {
    Severity: Minor
    Found in core/model/modx/modresource.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 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/mysql/moddbregistermessage.class.php - About 45 mins to fix

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

          public function initialize($contextKey= 'web', $options = null) {
              if (!$this->_initialized) {
                  if (!$this->startTime) {
                      $this->startTime= microtime(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 process has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function process() {
              if (!$this->get('cacheable') || !$this->_processed || !$this->_content) {
                  $this->_content= '';
                  $this->_output= '';
                  $this->xpdo->getParser();
      Severity: Minor
      Found in core/model/modx/modresource.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 setCurrentTopic has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function setCurrentTopic($topic) {
              if (is_string($topic) && strlen($topic) > 0) {
                  if ($topic[0] != '/') $topic = $this->_currentTopic . $topic;
                  if ($topic[strlen($topic) - 1] != '/') $topic .= '/';
                  $topicIdx = array_search($topic, $this->subscriptions);
      Severity: Minor
      Found in core/model/modx/registry/modregister.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 _readMessage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function _readMessage($obj, $remove = true) {
              $message = null;
              if (is_object($obj) && !empty($obj->payload)) {
                  $message = eval($obj->payload);
                  if ($remove || ($obj->expires > 1 && $obj->expires < time())) {
      Severity: Minor
      Found in core/model/modx/registry/moddbregister.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 getContent has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getContent(array $options = array()) {
              if (!is_string($this->_content) || $this->_content === '') {
                  if (isset($options['content'])) {
                      $this->_content = $options['content'];
                  } else {
      Severity: Minor
      Found in core/model/modx/modparser.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 _logInRegister has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

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

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

            public function get_password_data($instance_id, $opt = null)
            {
                if (!$opt) $opt = array();
                $opt['InstanceId'] = $instance_id;
        
        
        Severity: Minor
        Found in core/model/aws/services/ec2.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 parseValue has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          protected function parseValue($value)
          {
            if ('*' === substr($value, 0, 1))
            {
              if (false !== $pos = strpos($value, '#'))
        Severity: Minor
        Found in core/model/aws/lib/yaml/lib/sfYamlParser.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 create_cache_cluster has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function create_cache_cluster($cache_cluster_id, $num_cache_nodes, $cache_node_type, $engine, $cache_security_group_names, $opt = null)
        Severity: Minor
        Found in core/model/aws/services/elasticache.class.php - About 45 mins to fix

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

              public function set_object_acl($bucket, $filename, $acl = self::ACL_PRIVATE, $opt = null)
              {
                  // Add this to our request
                  if (!$opt) $opt = array();
                  $opt['verb'] = 'PUT';
          Severity: Minor
          Found in core/model/aws/services/s3.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 initiate_multipart_upload has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function initiate_multipart_upload($bucket, $filename, $opt = null)
              {
                  if (!$opt) $opt = array();
          
                  // Add this to our request
          Severity: Minor
          Found in core/model/aws/services/s3.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 copy_part has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function copy_part($source, $dest, $upload_id, $part_number, $opt = null)
              {
                  if (!$opt) $opt = array();
          
                  // Add this to our request
          Severity: Minor
          Found in core/model/aws/services/s3.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 create_auto_scaling_group has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public function create_auto_scaling_group($auto_scaling_group_name, $launch_configuration_name, $min_size, $max_size, $availability_zones, $opt = null)
          Severity: Minor
          Found in core/model/aws/services/as.class.php - About 45 mins to fix

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

                public static function autoload($class)
                {
                    if ($class[ 0 ] !== 'S' || strpos($class, 'Smarty') !== 0) {
                        return;
                    }
            Severity: Minor
            Found in core/model/smarty/Autoloader.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 set_read_stream has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public function set_read_stream($resource, $size = null)
                {
                    if (!isset($size) || $size < 0)
                    {
                        $stats = fstat($resource);
            Severity: Minor
            Found in core/model/aws/lib/requestcore/requestcore.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 remap_attribute_items_for_complextype has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function remap_attribute_items_for_complextype($keys, $replace = false)
                {
                    $map = array(
                        'Attribute' => array()
                    );
            Severity: Minor
            Found in core/model/aws/services/sdb.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_scalar($fval) && $fval !== '') {
                                            $currentResource[$fkey] = $fval;
                                        } elseif (is_array($fval) && count($fval) === 5 && $fval[1] !== '') {
                                            $currentResource[$fkey] = $fval;
                                        }
            Severity: Major
            Found in core/model/modx/modx.class.php - About 45 mins to fix
              Severity
              Category
              Status
              Source
              Language