symphonycms/symphony-2

View on GitHub

Showing 844 of 844 total issues

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

            if (
                isset($fields['filter'][$section_id]['system:id'])
                || isset($fields['filter'][$section_id]['id'])
            ) {
                $id = isset($fields['filter'][$section_id]['system:id'])
Severity: Major
Found in symphony/content/content.blueprintsdatasources.php and 1 other location - About 1 day to fix
symphony/content/content.blueprintsdatasources.php on lines 399..418

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

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 (
                isset($fields['filter'][$section_id]['system:creation-date'])
                || isset($fields['filter'][$section_id]['system:date'])
            ) {
                $creation_date = isset($fields['filter'][$section_id]['system:creation-date'])
Severity: Major
Found in symphony/content/content.blueprintsdatasources.php and 1 other location - About 1 day to fix
symphony/content/content.blueprintsdatasources.php on lines 365..384

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

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

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

<?php

/**
 * @package install
 */
Severity: Major
Found in install/lib/class.installer.php - About 1 day to fix

    File field.taglist.php has 526 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * @package toolkit
     */
    
    
    Severity: Major
    Found in symphony/lib/toolkit/fields/field.taglist.php - About 1 day to fix

      Method install has 215 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function install()
          {
              $db = null;
              $fields = $this->extendDatabaseFields(self::$POST['fields']);
              $start = time();
      Severity: Major
      Found in install/lib/class.installer.php - About 1 day to fix

        Function __viewIndex has a Cognitive Complexity of 54 (exceeds 5 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: Minor
        Found in symphony/content/content.systemextensions.php - About 1 day 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 __buildPage has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
        Open

            private function __buildPage($page)
            {
                $is_logged_in = static::isLoggedIn();
        
                if (empty($page) || is_null($page)) {
        Severity: Minor
        Found in symphony/lib/core/class.administration.php - About 1 day 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 content.blueprintsevents.php has 501 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /**
         * @package content
         */
        
        
        Severity: Major
        Found in symphony/content/content.blueprintsevents.php - About 1 day to fix

          Function symphonyDuplicator has 200 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              $.fn.symphonyDuplicator = function(options) {
                  var objects = this,
                      settings = {
                          instances: '> li:not(.template)',
                          templates: '> li.template',
          Severity: Major
          Found in symphony/assets/js/src/symphony.duplicator.js - About 1 day to fix

            General has 53 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class General
            {
                /**
                 * Convert any special characters into their entity equivalents. Since
                 * Symphony 2.3, this function assumes UTF-8 and will not double
            Severity: Major
            Found in symphony/lib/toolkit/class.general.php - About 7 hrs to fix

              Function symphonyDrawer has 187 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  $.fn.symphonyDrawer = function(options) {
                      var objects = this,
                          wrapper = $('#wrapper'),
                          contents = $('#contents'),
                          form = contents.find('> form'),
              Severity: Major
              Found in symphony/assets/js/src/symphony.drawer.js - About 7 hrs to fix

                Function __form has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function __form()
                    {
                        // Handle unknown context
                        if (!in_array($this->_context['action'], array('new', 'edit'))) {
                            Administration::instance()->errorPageNotFound();
                Severity: Minor
                Found in symphony/content/content.systemauthors.php - About 7 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 upgrade has 185 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function upgrade()
                    {
                        // Upgrade DB settings
                        $db = Symphony::Configuration()->get('database');
                        $db['driver'] = 'mysql';
                Severity: Major
                Found in install/migrations/3.0.0.php - About 7 hrs to fix

                  Method __viewEdit has 184 lines of code (exceeds 25 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: Major
                  Found in symphony/content/content.publish.php - About 7 hrs to fix

                    File field.author.php has 473 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php
                    
                    /**
                     * @package toolkit
                     */
                    Severity: Minor
                    Found in symphony/lib/toolkit/fields/field.author.php - About 7 hrs to fix

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

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

                        Function symphonyCollapsible has 178 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            $.fn.symphonyCollapsible = function(options) {
                                var objects = this,
                                    settings = {
                                        items: '.instance',
                                        handles: '.frame-header',
                        Severity: Major
                        Found in symphony/assets/js/src/symphony.collapsible.js - About 7 hrs to fix

                          Function __formAction has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function __formAction()
                              {
                                  $fields = $_POST['fields'];
                                  $this->_errors = array();
                                  $providers = Symphony::ExtensionManager()->getProvidersOf(iProvider::EVENT);
                          Severity: Minor
                          Found in symphony/content/content.blueprintsevents.php - About 7 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 duplicators has 177 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  objects.each(function duplicators() {
                                      var duplicator = $(this),
                                          list = duplicator.find('> ol'),
                                          apply = $('<fieldset class="apply" />'),
                                          selector = $('<select />'),
                          Severity: Major
                          Found in symphony/assets/js/src/symphony.duplicator.js - About 7 hrs to fix

                            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
                              Severity
                              Category
                              Status
                              Source
                              Language