symphonycms/symphony-2

View on GitHub

Showing 844 of 844 total issues

Avoid too many return statements within this method.
Open

            return false;
Severity: Major
Found in symphony/lib/toolkit/events/class.event.section.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

            return $this->validateFilename($data['name'], $message);
    Severity: Major
    Found in symphony/lib/toolkit/fields/field.upload.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                  return false;
      Severity: Major
      Found in symphony/lib/toolkit/fields/field.upload.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                        return $data[0];
        Severity: Major
        Found in symphony/lib/toolkit/cache/cache.database.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return self::__ERROR__;
          Severity: Major
          Found in symphony/lib/toolkit/fields/field.upload.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                                return self::ERROR;
            Severity: Major
            Found in symphony/lib/toolkit/fields/field.date.php - About 30 mins to fix

              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

                Avoid too many return statements within this method.
                Open

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

                  Avoid too many return statements within this method.
                  Open

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

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

                            if (is_array($datasources) && !empty($datasources)) {
                                if (!isset($fields['data_sources'])) {
                                    $fields['data_sources'] = array();
                                }
                    
                    
                    Severity: Minor
                    Found in symphony/content/content.blueprintspages.php and 1 other location - About 30 mins to fix
                    symphony/content/content.blueprintspages.php on lines 491..501

                    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 (is_array($events) && !empty($events)) {
                                if (!isset($fields['events'])) {
                                    $fields['events'] = array();
                                }
                    
                    
                    Severity: Minor
                    Found in symphony/content/content.blueprintspages.php and 1 other location - About 30 mins to fix
                    symphony/content/content.blueprintspages.php on lines 514..524

                    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 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 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 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 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 __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 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 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 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

                    Severity
                    Category
                    Status
                    Source
                    Language