symphonycms/symphony-2

View on GitHub

Showing 714 of 844 total issues

Avoid too many return statements within this method.
Open

            return false;
Severity: Major
Found in symphony/lib/core/class.administration.php - About 30 mins to fix

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

        public function buildRegexSQL($filter, array $columns, &$joins, &$where)
        {
            if (Symphony::Log()) {
                Symphony::Log()->pushDeprecateWarningToLog(
                    get_called_class() . '::buildRegexSQL()',
    Severity: Minor
    Found in symphony/lib/toolkit/class.field.php - 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 TableRow has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function TableRow(array $cells, $class = null, $id = null, $rowspan = null, Array $attributes = null)
        {
            General::ensureType(array(
                'class' => array('var' => $class, 'type' => 'string', 'optional' => true),
                'id' => array('var' => $id, 'type' => 'string', 'optional' => true),
    Severity: Minor
    Found in symphony/lib/toolkit/class.widget.php - 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 checkUnattended has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        private function checkUnattended()
        {
            $filepath = MANIFEST . '/unattend.php';
            if (!@file_exists($filepath) || !@is_readable($filepath)) {
                return false;
    Severity: Minor
    Found in install/lib/class.installer.php - 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 fetchSchemaFieldIds has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function fetchSchemaFieldIds($section_id)
        {
            if (empty($this->schema)) {
                return [];
            } elseif (General::intval(current($this->schema)) > 0) {
    Severity: Minor
    Found in symphony/lib/toolkit/class.entryqueryresult.php - 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 exists has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function exists()
        {
            if (!$this->get('id') || !$this->_handle) {
                return false;
            }
    Severity: Minor
    Found in symphony/lib/toolkit/class.field.php - 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 __SelectBuildOption has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        private static function __SelectBuildOption($option)
        {
            list($value, $selected, $desc, $class, $id, $attributes) = array_pad($option, 6, null);
    
            if (!$desc) {
    Severity: Minor
    Found in symphony/lib/toolkit/class.widget.php - 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 translate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function translate($string, array $inserts = null, $namespace = null)
        {
            if (!$namespace) {
                $namespace = Symphony::getPageNamespace();
            }
    Severity: Minor
    Found in symphony/lib/toolkit/class.lang.php - 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 setAttachments has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function setAttachments($files)
        {
            // Always erase
            $this->_attachments = array();
    
    
    Severity: Minor
    Found in symphony/lib/toolkit/class.emailgateway.php - 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 limitWords has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function limitWords($string, $maxChars = 200, $appendHellip = false)
        {
            if ($appendHellip) {
                $maxChars -= 1;
            }
    Severity: Minor
    Found in symphony/lib/toolkit/class.general.php - 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 quoteFields has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function quoteFields(array &$array)
        {
            foreach ($array as $key => $val) {
                // Handle arrays with more than 1 level
                if (is_array($val)) {
    Severity: Minor
    Found in symphony/lib/toolkit/class.database.php - 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 mergeFilePostData has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        protected static function mergeFilePostData($type, array $file, array &$post)
        {
            foreach ($file as $key => $value) {
                if (!isset($post[$key])) {
                    $post[$key] = array();
    Severity: Minor
    Found in symphony/lib/toolkit/class.general.php - 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 writeFile has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function writeFile($file, $data, $perm = 0644, $mode = 'w', $trim = false)
        {
            if (static::checkFileWritable($file) === false) {
                return false;
            }
    Severity: Minor
    Found in symphony/lib/toolkit/class.general.php - 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 sortByAuthor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        private static function sortByAuthor($a, $b, $i = 0)
        {
            $first = $a;
            $second = $b;
    
    
    Severity: Minor
    Found in symphony/lib/toolkit/class.extensionmanager.php - 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 fetchCount has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function fetchCount($section_id = null, $where = null, $joins = null, $group = false)
        {
            if (Symphony::Log()) {
                Symphony::Log()->pushDeprecateWarningToLog('EntryManager::fetchCount()', 'EntryManager::select()->count()');
            }
    Severity: Minor
    Found in symphony/lib/toolkit/class.entrymanager.php - 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 fetch has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function fetch($query = null, $index_by_column = null)
        {
            if (!is_null($query)) {
                $this->query($query, "ASSOC");
            } elseif (is_null($this->_lastResult)) {
    Severity: Minor
    Found in symphony/lib/toolkit/class.database.php - 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 fetchByID has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function fetchByID($id)
        {
            $return_single = false;
    
            if (is_null($id)) {
    Severity: Minor
    Found in symphony/lib/toolkit/class.authormanager.php - 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 enable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function enable($name)
        {
            $obj = self::getInstance($name);
    
            // If not installed, install it
    Severity: Minor
    Found in symphony/lib/toolkit/class.extensionmanager.php - 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 createFilterRegexp has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function createFilterRegexp($filter, array $columns)
        {
            $field_id = General::intval($this->field->get('id'));
            $filter = $this->field->cleanValue($filter);
            $pattern = '';
    Severity: Minor
    Found in symphony/lib/toolkit/class.entryqueryfieldadapter.php - 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 prepareExportValue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function prepareExportValue($data, $mode, $entry_id = null)
        {
            $modes = (object)$this->getExportModes();
    
            // Export handles:
    Severity: Minor
    Found in symphony/lib/toolkit/fields/field.input.php - 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