symphonycms/symphony-2

View on GitHub

Showing 844 of 844 total issues

Method __actionNew has 174 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function __actionNew()
    {
        if (is_array($_POST['action']) && array_key_exists('save', $_POST['action'])) {
            $canProceed = true;
            $edit = ($this->_context['action'] === "edit");
Severity: Major
Found in symphony/content/content.blueprintssections.php - About 6 hrs to fix

    File class.datasource.section.php has 455 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /**
     * @package data-sources
     */
    Severity: Minor
    Found in symphony/lib/toolkit/data-sources/class.datasource.section.php - About 6 hrs to fix

      Function __actionNew has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
      Open

          public function __actionNew()
          {
              if (is_array($_POST['action']) && array_key_exists('save', $_POST['action'])) {
                  $section_id = SectionManager::fetchIDFromHandle($this->_context['section_handle']);
      
      
      Severity: Minor
      Found in symphony/content/content.publish.php - About 6 hrs 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 Symphony has 171 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      var Symphony = (function($, crossroads) {
          'use strict';
      
          // Internal Symphony storage
          var Storage = {
      Severity: Major
      Found in symphony/assets/js/src/symphony.js - About 6 hrs to fix

        Method __viewEdit has 170 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function __viewEdit()
            {
                $section_id = $this->_context['id'];
                $section = (new SectionManager)->select()->section($section_id)->execute()->next();
        
        
        Severity: Major
        Found in symphony/content/content.blueprintssections.php - About 6 hrs to fix

          Function __buildPage has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
          Open

              private function __buildPage()
              {
                  $start = precision_timer();
          
                  if (!$page = $this->resolvePage()) {
          Severity: Minor
          Found in symphony/lib/toolkit/class.frontendpage.php - About 6 hrs 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 appendNavigation has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
          Open

              public function appendNavigation()
              {
                  $nav = $this->getNavigationArray();
          
                  /**
          Severity: Minor
          Found in symphony/lib/toolkit/class.administrationpage.php - About 6 hrs 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

          File class.pagemanager.php has 441 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          /**
           * @package toolkit
           */
          Severity: Minor
          Found in symphony/lib/toolkit/class.pagemanager.php - About 6 hrs to fix

            Function __viewEdit has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
            Open

                public function __viewEdit()
                {
                    $this->setPageType('form');
                    $fields = array("title"=>null, "handle"=>null, "parent"=>null, "params"=>null, "type"=>null, "data_sources"=>null);
                    $existing = $fields;
            Severity: Minor
            Found in symphony/content/content.blueprintspages.php - About 6 hrs 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 collapsible has 164 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    objects.each(function collapsible(index) {
                        var object = $(this),
                            storage = settings.storage + '.' + index + '.collapsed';
            
                        var getDuration = function (duration) {
            Severity: Major
            Found in symphony/assets/js/src/symphony.collapsible.js - About 6 hrs to fix

              Method __viewIndex has 162 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function __viewIndex()
                  {
                      $canonical_link = '/system/extensions/';
                      $this->setPageType('table');
                      $this->setTitle(__('%1$s &ndash; %2$s', array(__('Extensions'), __('Symphony'))));
              Severity: Major
              Found in symphony/content/content.systemextensions.php - About 6 hrs to fix

                Function processFilters has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function processFilters(&$entryQuery)
                    {
                        if (!is_array($this->dsParamFILTERS) || empty($this->dsParamFILTERS)) {
                            return;
                        }
                Severity: Minor
                Found in symphony/lib/toolkit/data-sources/class.datasource.section.php - About 6 hrs 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 __viewEdit has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function __viewEdit()
                    {
                        if (!$section_id = SectionManager::fetchIDFromHandle($this->_context['section_handle'])) {
                            Administration::instance()->throwCustomError(
                                __('The Section, %s, could not be found.', array('<code>' . $this->_context['section_handle'] . '</code>')),
                Severity: Minor
                Found in symphony/content/content.publish.php - About 6 hrs 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

                Method __viewIndex has 159 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function __viewIndex($resource_type)
                    {
                        $manager = ResourceManager::getManagerFromType($resource_type);
                        $friendly_resource = ($resource_type === ResourceManager::RESOURCE_TYPE_EVENT) ? __('Event') : __('DataSource');
                        $context = Administration::instance()->getPageCallback();
                Severity: Major
                Found in symphony/lib/toolkit/class.resourcespage.php - About 6 hrs to fix

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

                      public function groupRecords($records)
                      {
                          if (!is_array($records) || empty($records)) {
                              return;
                          }
                  Severity: Major
                  Found in symphony/lib/toolkit/fields/field.input.php and 1 other location - About 6 hrs to fix
                  symphony/lib/toolkit/fields/field.select.php on lines 508..532

                  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 211.

                  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

                      public function groupRecords($records)
                      {
                          if (!is_array($records) || empty($records)) {
                              return;
                          }
                  Severity: Major
                  Found in symphony/lib/toolkit/fields/field.select.php and 1 other location - About 6 hrs to fix
                  symphony/lib/toolkit/fields/field.input.php on lines 422..446

                  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 211.

                  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

                      protected function validateTimestamp($section_id, $checkMissing = false)
                      {
                          if (!isset($_POST['action']['ignore-timestamp'])) {
                              if ($checkMissing && !isset($_POST['action']['timestamp'])) {
                                  if (isset($this->_errors) && is_array($this->_errors)) {
                  Severity: Major
                  Found in symphony/content/content.blueprintssections.php and 1 other location - About 6 hrs to fix
                  symphony/content/content.publish.php on lines 2140..2159

                  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 209.

                  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

                      protected function validateTimestamp($entry_id, $checkMissing = false)
                      {
                          if (!isset($_POST['action']['ignore-timestamp'])) {
                              if ($checkMissing && !isset($_POST['action']['timestamp'])) {
                                  if (isset($this->_errors) && is_array($this->_errors)) {
                  Severity: Major
                  Found in symphony/content/content.publish.php and 1 other location - About 6 hrs to fix
                  symphony/content/content.blueprintssections.php on lines 1041..1060

                  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 209.

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

                      public static function fetch($type, array $select = array(), array $where = array(), $order_by = null)
                      {
                          $manager = self::getManagerFromType($type);
                  
                          if (!isset($manager)) {
                  Severity: Minor
                  Found in symphony/lib/toolkit/class.resourcemanager.php - About 6 hrs 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 processEntry has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function processEntry(Entry $entry)
                      {
                          $data = $entry->getData();
                  
                          $xEntry = new XMLElement('entry');
                  Severity: Minor
                  Found in symphony/lib/toolkit/data-sources/class.datasource.section.php - About 6 hrs 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