modxcms/revolution

View on GitHub
core/model/smarty/sysplugins/smarty_internal_method_mustcompile.php

Summary

Maintainability
A
1 hr
Test Coverage

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

    public function mustCompile(Smarty_Internal_Template $_template)
    {
        if (!$_template->source->exists) {
            if ($_template->_isSubTpl()) {
                $parent_resource = " in '$_template->parent->template_resource}'";
Severity: Minor
Found in core/model/smarty/sysplugins/smarty_internal_method_mustcompile.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

Consider simplifying this complex logical expression.
Open

        if ($_template->mustCompile === null) {
            $_template->mustCompile = (!$_template->source->handler->uncompiled &&
                                       ($_template->smarty->force_compile || $_template->source->handler->recompiled ||
                                        !$_template->compiled->exists || ($_template->compile_check &&
                                                                          $_template->compiled->getTimeStamp() <
Severity: Major
Found in core/model/smarty/sysplugins/smarty_internal_method_mustcompile.php - About 40 mins to fix

    There are no issues that match your filters.

    Category
    Status