modxcms/revolution

View on GitHub

Showing 7,873 of 7,873 total issues

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

    function restore($revisions= array (), $restore= 0) {
        reset($revisions);
        $restored= current($revisions);
        if ($restore && next($revisions)) {
            while (list($k, $v)= each($revisions)) {
Severity: Minor
Found in core/xpdo/revision/xpdorevisioncontrol.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 getTables has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function getTables() {
        $c = new xPDOCriteria($this->modx, "select [name] from sys.Tables where [type] = 'U' ORDER BY [name]");
        $c->stmt->execute();
        $table_names = $c->stmt->fetchAll(PDO::FETCH_COLUMN);
Severity: Minor
Found in core/model/modx/processors/system/databasetable/getlist.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 moveObject has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function moveObject($from,$to,$point = 'append') {
        $this->xpdo->lexicon->load('source');
        $success = false;

        if (substr(strrev($from),0,1) == '/') {
Severity: Minor
Found in core/model/modx/sources/mods3mediasource.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 getTables has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function getTables() {
        $c = new xPDOCriteria($this->modx, 'SHOW TABLE STATUS FROM '.$this->modx->escape($this->modx->getOption('dbname')));
        $c->stmt->execute();
        $dt = array();
        while ($row= $c->stmt->fetch(PDO::FETCH_ASSOC)) {
Severity: Minor
Found in core/model/modx/processors/system/databasetable/getlist.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 checkParentPermissions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function checkParentPermissions() {
        $parent = null;
        $parentId = intval($this->getProperty('parent'));
        if ($parentId > 0) {
            $this->parentResource = $this->modx->getObject('modResource',$parentId);
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

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

    public function clearCache(array $options = array()) {
        /** @var modCacheManager $cacheManager */
        $cacheManager = $this->xpdo->getCacheManager();
        if (empty($cacheManager)) return;

Severity: Minor
Found in core/model/modx/sources/modmediasource.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 optimize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function optimize() {
        $stmt = $this->modx->query('SHOW TABLES');
        if ($stmt && $stmt instanceof PDOStatement) {
            while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
                if (!empty($row[0])) {

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

            function parseArray($needle,array $haystack = array()) {
                if (!is_array($haystack)) return false;
                $results = array();
                foreach($haystack as $key=>$value) {
                    if (strpos($key, $needle)!==false || strpos($value,$needle) !== false) {
Severity: Minor
Found in core/model/modx/processors/workspace/lexicon/getlist.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() {
        $where = array(
            'namespace' => $this->getProperty('namespace'),
            'topic' => $this->getProperty('topic'),
            'language' => $this->getProperty('language'),
Severity: Minor
Found in core/model/modx/processors/workspace/lexicon/getlist.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 hasAccess has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function hasAccess($user = null,$context = '') {
        /** @var modUser $user */
        $user = !empty($user) ? $user : $this->xpdo->user;
        if (is_object($context)) $context = $context->get('key');
        $resourceGroups = $user->getResourceGroups($context);
Severity: Minor
Found in core/model/modx/modresourcegroup.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 afterSave has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function afterSave() {
        /* if changing key */
        if ($this->isRename) {
            $newName = $this->getProperty('newName');
            if ($this->doesAlreadyExist(array('text' => $newName))) {
Severity: Minor
Found in core/model/modx/processors/system/menu/update.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() {
        $this->getRootNode();
        $this->prepare();

        if (empty($this->contextKey) || $this->contextKey == 'root') {
Severity: Minor
Found in core/model/modx/processors/resource/getnodes.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 fixParents has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function fixParents($node) {
        $nodeObject = $this->modx->getObject('modResource', $node->id);

        /** @var modResource $oldParent */
        $oldParent = $this->modx->getObject('modResource', $nodeObject->parent);
Severity: Minor
Found in core/model/modx/processors/resource/sort.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($featureItem)) { continue; }
Severity: Major
Found in core/model/modx/processors/resource/reload.class.php - About 45 mins to fix

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

        public function process() {
            $o = @file_get_contents($this->file['tmp_name']);
            if (empty($o)) {
                return $this->failure($this->modx->lexicon('properties_import_err_upload'));
            }
    Severity: Minor
    Found in core/model/modx/processors/element/importproperties.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 checkPublishedOn has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function checkPublishedOn() {
            $published = $this->getProperty('published',null);
            if ($published !== null && $published != $this->object->get('published')) {
                if (empty($published)) { /* if unpublishing */
                    $this->setProperty('publishedon',0);
    Severity: Minor
    Found in core/model/modx/processors/resource/update.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 getRenderOutput has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getRenderOutput(array $renderDirectories) {
            $o = '';
            foreach ($renderDirectories as $renderDirectory) {
                if (empty($renderDirectory) || !is_dir($renderDirectory)) continue;
    
    

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

        public function sort(){
            if (($this->source instanceof modContext) && ($this->target instanceof modContext)) {
                return $this->sortContexts();
            }
    
    
    Severity: Minor
    Found in core/model/modx/processors/resource/sort.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 beforeRemove has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function beforeRemove() {
            /* check to make sure it doesn't have any resources using it */
            $resources = $this->modx->getCollection('modResource',array(
                'deleted' => 0,
                'template' => $this->object->get('id'),
    Severity: Minor
    Found in core/model/modx/processors/element/template/remove.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 getCategoryNode has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getCategoryNode($category) {
            $list = array();
    
            $c = $this->modx->newQuery($this->classKey);
            $c->where(array('category' => $category));
    Severity: Minor
    Found in core/model/modx/processors/element/propertyset/getnodes.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