modxcms/revolution

View on GitHub

Showing 7,873 of 7,873 total issues

Similar blocks of code found in 17 locations. Consider refactoring.
Open

    public function revoke_cache_security_group_ingress($cache_security_group_name, $ec2_security_group_name, $ec2_security_group_owner_id, $opt = null)
    {
        if (!$opt) $opt = array();
        $opt['CacheSecurityGroupName'] = $cache_security_group_name;
        $opt['EC2SecurityGroupName'] = $ec2_security_group_name;
Severity: Major
Found in core/model/aws/services/elasticache.class.php and 16 other locations - About 30 mins to fix
core/model/aws/services/cloudwatch.class.php on lines 589..597
core/model/aws/services/ec2.class.php on lines 1077..1085
core/model/aws/services/ec2.class.php on lines 1928..1936
core/model/aws/services/ec2.class.php on lines 2028..2036
core/model/aws/services/ec2.class.php on lines 3382..3390
core/model/aws/services/elasticache.class.php on lines 206..214
core/model/aws/services/elasticache.class.php on lines 517..525
core/model/aws/services/elb.class.php on lines 441..449
core/model/aws/services/elb.class.php on lines 502..510
core/model/aws/services/iam.class.php on lines 251..259
core/model/aws/services/iam.class.php on lines 542..550
core/model/aws/services/iam.class.php on lines 760..768
core/model/aws/services/importexport.class.php on lines 95..103
core/model/aws/services/rds.class.php on lines 368..376
core/model/aws/services/sns.class.php on lines 208..216
core/model/aws/services/sns.class.php on lines 230..238

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 90.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 17 locations. Consider refactoring.
Open

    public function create_customer_gateway($type, $ip_address, $bgp_asn, $opt = null)
    {
        if (!$opt) $opt = array();
        $opt['Type'] = $type;
        $opt['IpAddress'] = $ip_address;
Severity: Major
Found in core/model/aws/services/ec2.class.php and 16 other locations - About 30 mins to fix
core/model/aws/services/cloudwatch.class.php on lines 589..597
core/model/aws/services/ec2.class.php on lines 1077..1085
core/model/aws/services/ec2.class.php on lines 2028..2036
core/model/aws/services/ec2.class.php on lines 3382..3390
core/model/aws/services/elasticache.class.php on lines 206..214
core/model/aws/services/elasticache.class.php on lines 517..525
core/model/aws/services/elasticache.class.php on lines 567..575
core/model/aws/services/elb.class.php on lines 441..449
core/model/aws/services/elb.class.php on lines 502..510
core/model/aws/services/iam.class.php on lines 251..259
core/model/aws/services/iam.class.php on lines 542..550
core/model/aws/services/iam.class.php on lines 760..768
core/model/aws/services/importexport.class.php on lines 95..103
core/model/aws/services/rds.class.php on lines 368..376
core/model/aws/services/sns.class.php on lines 208..216
core/model/aws/services/sns.class.php on lines 230..238

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 90.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

        foreach ($this->query['from']['tables'] as $table) {
            if ($command != 'SELECT') {
                $tables[]= $this->xpdo->escape($table['table']);
            } else {
                $tables[]= $this->xpdo->escape($table['table']) . ' AS ' . $this->xpdo->escape($table['alias']);
Severity: Minor
Found in core/xpdo/om/sqlsrv/xpdoquery.class.php and 1 other location - About 30 mins to fix
core/xpdo/om/sqlite/xpdoquery.class.php on lines 77..83

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 90.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

        foreach ($this->query['from']['tables'] as $table) {
            if ($command != 'SELECT') {
                $tables[]= $this->xpdo->escape($table['table']);
            } else {
                $tables[]= $this->xpdo->escape($table['table']) . ' AS ' . $this->xpdo->escape($table['alias']);
Severity: Minor
Found in core/xpdo/om/sqlite/xpdoquery.class.php and 1 other location - About 30 mins to fix
core/xpdo/om/sqlsrv/xpdoquery.class.php on lines 244..250

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 90.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 17 locations. Consider refactoring.
Open

    public function put_user_policy($user_name, $policy_name, $policy_document, $opt = null)
    {
        if (!$opt) $opt = array();
        $opt['UserName'] = $user_name;
        $opt['PolicyName'] = $policy_name;
Severity: Major
Found in core/model/aws/services/iam.class.php and 16 other locations - About 30 mins to fix
core/model/aws/services/cloudwatch.class.php on lines 589..597
core/model/aws/services/ec2.class.php on lines 1077..1085
core/model/aws/services/ec2.class.php on lines 1928..1936
core/model/aws/services/ec2.class.php on lines 2028..2036
core/model/aws/services/ec2.class.php on lines 3382..3390
core/model/aws/services/elasticache.class.php on lines 206..214
core/model/aws/services/elasticache.class.php on lines 517..525
core/model/aws/services/elasticache.class.php on lines 567..575
core/model/aws/services/elb.class.php on lines 441..449
core/model/aws/services/elb.class.php on lines 502..510
core/model/aws/services/iam.class.php on lines 542..550
core/model/aws/services/iam.class.php on lines 760..768
core/model/aws/services/importexport.class.php on lines 95..103
core/model/aws/services/rds.class.php on lines 368..376
core/model/aws/services/sns.class.php on lines 208..216
core/model/aws/services/sns.class.php on lines 230..238

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 90.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 17 locations. Consider refactoring.
Open

    public function attach_volume($volume_id, $instance_id, $device, $opt = null)
    {
        if (!$opt) $opt = array();
        $opt['VolumeId'] = $volume_id;
        $opt['InstanceId'] = $instance_id;
Severity: Major
Found in core/model/aws/services/ec2.class.php and 16 other locations - About 30 mins to fix
core/model/aws/services/cloudwatch.class.php on lines 589..597
core/model/aws/services/ec2.class.php on lines 1928..1936
core/model/aws/services/ec2.class.php on lines 2028..2036
core/model/aws/services/ec2.class.php on lines 3382..3390
core/model/aws/services/elasticache.class.php on lines 206..214
core/model/aws/services/elasticache.class.php on lines 517..525
core/model/aws/services/elasticache.class.php on lines 567..575
core/model/aws/services/elb.class.php on lines 441..449
core/model/aws/services/elb.class.php on lines 502..510
core/model/aws/services/iam.class.php on lines 251..259
core/model/aws/services/iam.class.php on lines 542..550
core/model/aws/services/iam.class.php on lines 760..768
core/model/aws/services/importexport.class.php on lines 95..103
core/model/aws/services/rds.class.php on lines 368..376
core/model/aws/services/sns.class.php on lines 208..216
core/model/aws/services/sns.class.php on lines 230..238

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 90.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 17 locations. Consider refactoring.
Open

    public function create_db_parameter_group($db_parameter_group_name, $db_parameter_group_family, $description, $opt = null)
    {
        if (!$opt) $opt = array();
        $opt['DBParameterGroupName'] = $db_parameter_group_name;
        $opt['DBParameterGroupFamily'] = $db_parameter_group_family;
Severity: Major
Found in core/model/aws/services/rds.class.php and 16 other locations - About 30 mins to fix
core/model/aws/services/cloudwatch.class.php on lines 589..597
core/model/aws/services/ec2.class.php on lines 1077..1085
core/model/aws/services/ec2.class.php on lines 1928..1936
core/model/aws/services/ec2.class.php on lines 2028..2036
core/model/aws/services/ec2.class.php on lines 3382..3390
core/model/aws/services/elasticache.class.php on lines 206..214
core/model/aws/services/elasticache.class.php on lines 517..525
core/model/aws/services/elasticache.class.php on lines 567..575
core/model/aws/services/elb.class.php on lines 441..449
core/model/aws/services/elb.class.php on lines 502..510
core/model/aws/services/iam.class.php on lines 251..259
core/model/aws/services/iam.class.php on lines 542..550
core/model/aws/services/iam.class.php on lines 760..768
core/model/aws/services/importexport.class.php on lines 95..103
core/model/aws/services/sns.class.php on lines 208..216
core/model/aws/services/sns.class.php on lines 230..238

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 90.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            if ($expectedSysplugins) {
                $status = false;
                $message = "FAILED: files missing from libs/sysplugins: " . join(', ', array_keys($expectedSysplugins));
                if ($errors === null) {
                    echo $message . ".\n";
Severity: Minor
Found in core/model/smarty/sysplugins/smarty_internal_testinstall.php and 1 other location - About 30 mins to fix
core/model/smarty/sysplugins/smarty_internal_testinstall.php on lines 583..593

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 90.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                foreach ($acls as $acl) {
                    $policy['modAccessCategory'][$acl->get('target')][] = array(
                        'principal' => $acl->get('principal'),
                        'authority' => $acl->get('authority'),
                        'policy' => $acl->get('data') ? $this->xpdo->fromJSON($acl->get('data'), true) : array(),
Severity: Minor
Found in core/model/modx/modcategory.class.php and 1 other location - About 30 mins to fix
core/model/modx/modcontext.class.php on lines 186..192

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 90.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            case 'attach':
                $body .= $mimepre;
                $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, '', $bodyEncoding);
                $body .= $this->encodeString($this->Body, $bodyEncoding);
                $body .= static::$LE;
Severity: Minor
Found in core/model/modx/mail/phpmailer/src/PHPMailer.php and 1 other location - About 30 mins to fix
core/model/modx/mail/phpmailer/src/PHPMailer.php on lines 2797..2803

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 90.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            if ($expectedPlugins) {
                $status = false;
                $message = "FAILED: files missing from libs/plugins: " . join(', ', array_keys($expectedPlugins));
                if ($errors === null) {
                    echo $message . ".\n";
Severity: Minor
Found in core/model/smarty/sysplugins/smarty_internal_testinstall.php and 1 other location - About 30 mins to fix
core/model/smarty/sysplugins/smarty_internal_testinstall.php on lines 499..509

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 90.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            case 'inline':
                $body .= $mimepre;
                $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, '', $bodyEncoding);
                $body .= $this->encodeString($this->Body, $bodyEncoding);
                $body .= static::$LE;
Severity: Minor
Found in core/model/modx/mail/phpmailer/src/PHPMailer.php and 1 other location - About 30 mins to fix
core/model/modx/mail/phpmailer/src/PHPMailer.php on lines 2804..2810

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 90.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                if (!$adminContextAccess) {
                    $adminContextAccess = $this->modx->newObject('modAccessContext');
                    $adminContextAccess->set('principal', $adminGroup->get('id'));
                    $adminContextAccess->set('principal_class', 'modUserGroup');
                    $adminContextAccess->set('target', $this->object->get('target'));
core/model/modx/processors/context/create.class.php on lines 78..86

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 90.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 17 locations. Consider refactoring.
Open

    public function create_job($job_type, $manifest, $validate_only, $opt = null)
    {
        if (!$opt) $opt = array();
        $opt['JobType'] = $job_type;
        $opt['Manifest'] = $manifest;
Severity: Major
Found in core/model/aws/services/importexport.class.php and 16 other locations - About 30 mins to fix
core/model/aws/services/cloudwatch.class.php on lines 589..597
core/model/aws/services/ec2.class.php on lines 1077..1085
core/model/aws/services/ec2.class.php on lines 1928..1936
core/model/aws/services/ec2.class.php on lines 2028..2036
core/model/aws/services/ec2.class.php on lines 3382..3390
core/model/aws/services/elasticache.class.php on lines 206..214
core/model/aws/services/elasticache.class.php on lines 517..525
core/model/aws/services/elasticache.class.php on lines 567..575
core/model/aws/services/elb.class.php on lines 441..449
core/model/aws/services/elb.class.php on lines 502..510
core/model/aws/services/iam.class.php on lines 251..259
core/model/aws/services/iam.class.php on lines 542..550
core/model/aws/services/iam.class.php on lines 760..768
core/model/aws/services/rds.class.php on lines 368..376
core/model/aws/services/sns.class.php on lines 208..216
core/model/aws/services/sns.class.php on lines 230..238

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 90.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                foreach ($acls as $acl) {
                    $policy['modAccessContext'][$acl->get('target')][] = array(
                        'principal' => $acl->get('principal'),
                        'authority' => $acl->get('authority'),
                        'policy' => $acl->get('data') ? $this->xpdo->fromJSON($acl->get('data'), true) : array(),
Severity: Minor
Found in core/model/modx/modcontext.class.php and 1 other location - About 30 mins to fix
core/model/modx/modcategory.class.php on lines 165..171

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 90.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            if ($adminContextPolicy) {
                /** @var modAccessContext $adminAdminAccess */
                $adminAdminAccess = $this->modx->newObject('modAccessContext');
                $adminAdminAccess->set('principal',$adminGroup->get('id'));
                $adminAdminAccess->set('principal_class','modUserGroup');
Severity: Minor
Found in core/model/modx/processors/context/create.class.php and 1 other location - About 30 mins to fix
core/model/modx/processors/security/access/usergroup/context/create.class.php on lines 81..88

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 90.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function Lexicon has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

MODx.grid.Lexicon = function(config) {
    config = config || {};
    Ext.applyIf(config,{
        id: 'modx-grid-lexicon'
        ,url: MODx.config.connector_url
Severity: Minor
Found in manager/assets/modext/workspace/lexicon/lexicon.grid.js - About 25 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 append has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

Ext.form.BasicForm.prototype.append = function() {
  var layout = new Ext.form.Layout();
  var fields = [];
  layout.stack.push.apply(layout.stack, arguments);
  for(var i = 0; i < arguments.length; i=i+1) {
Severity: Minor
Found in manager/assets/modext/util/utilities.js - About 25 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 onRender has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    ,onRender:function(ct, position) {
        // don't run more than once
        if(this.isRendered) {
            return;
        }
Severity: Minor
Found in manager/assets/modext/util/datetime.js - About 25 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 updateHidden has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

Ext.form.XCheckbox=Ext.extend(Ext.form.Checkbox,{submitOffValue:0,submitOnValue:1,onRender:function(){this.inputValue=this.submitOnValue;Ext.form.XCheckbox.superclass.onRender.apply(this,arguments);this.hiddenField=this.wrap.insertFirst({tag:'input',type:'hidden'});if(this.tooltip){this.imageEl.set({qtip:this.tooltip})}this.updateHidden()},setValue:function(v){v=this.convertValue(v);this.updateHidden(v);Ext.form.XCheckbox.superclass.setValue.apply(this,arguments)},updateHidden:function(v){v=undefined!==v?v:this.checked;v=this.convertValue(v);if(this.hiddenField){this.hiddenField.dom.value=v?this.submitOnValue:this.submitOffValue;this.hiddenField.dom.name=v?'':this.el.dom.name}},convertValue:function(v){return(v===true||v==='true'||v===this.submitOnValue||String(v).toLowerCase()==='on')}});Ext.reg('xcheckbox',Ext.form.XCheckbox);
Severity: Minor
Found in manager/assets/modext/util/utilities.js - About 25 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