symphonycms/symphony-2

View on GitHub

Showing 844 of 844 total issues

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

        if ($formHasErrors) {
            $this->pageAlert(
                __('An error occurred while processing this form. See below for details.'),
                Alert::ERROR
            );
Severity: Major
Found in symphony/content/content.blueprintsdatasources.php and 2 other locations - About 5 hrs to fix
symphony/content/content.blueprintsevents.php on lines 40..67
symphony/content/content.blueprintssections.php on lines 357..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 189.

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 35 (exceeds 5 allowed). Consider refactoring.
Open

    private static function fetch()
    {
        if (!@is_readable(EXTENSIONS)) {
            return;
        }
Severity: Minor
Found in symphony/lib/toolkit/class.lang.php - About 5 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 __buildPage has 129 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function __buildPage()
    {
        $start = precision_timer();

        if (!$page = $this->resolvePage()) {
Severity: Major
Found in symphony/lib/toolkit/class.frontendpage.php - About 5 hrs to fix

    Function __viewIndex has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
    Open

        public function __viewIndex()
        {
            $this->setPageType('table');
            $this->setTitle(__('%1$s – %2$s', array(__('Authors'), __('Symphony'))));
    
    
    Severity: Minor
    Found in symphony/content/content.systemauthors.php - About 5 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

    EmailGateway has 38 functions (exceeds 20 allowed). Consider refactoring.
    Open

    abstract class EmailGateway
    {
        protected $_recipients = array();
        protected $_sender_name;
        protected $_sender_email_address;
    Severity: Minor
    Found in symphony/lib/toolkit/class.emailgateway.php - About 5 hrs to fix

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

                  if (!empty($editors)) {
                      $label = Widget::Label(__('Association Editor'), null, 'column');
                      $label->appendChild(new XMLElement('i', __('Optional')));
      
                      $options = array(
      Severity: Major
      Found in symphony/lib/toolkit/class.field.php and 1 other location - About 5 hrs to fix
      symphony/lib/toolkit/class.field.php on lines 791..805

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

      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 (!empty($interfaces)) {
                      $label = Widget::Label(__('Association Interface'), null, 'column');
                      $label->appendChild(new XMLElement('i', __('Optional')));
      
                      $options = array(
      Severity: Major
      Found in symphony/lib/toolkit/class.field.php and 1 other location - About 5 hrs to fix
      symphony/lib/toolkit/class.field.php on lines 808..822

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

      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 field.select.php has 371 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

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

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

            public function __viewIndex()
            {
                $this->setPageType('table');
                $this->setTitle(__('%1$s &ndash; %2$s', array(__('Pages'), __('Symphony'))));
        
        
        Severity: Major
        Found in symphony/content/content.blueprintspages.php - About 4 hrs to fix

          Function __viewIndex has a Cognitive Complexity of 32 (exceeds 5 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: Minor
          Found in symphony/lib/toolkit/class.resourcespage.php - About 4 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 __viewNew has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
          Open

              public function __viewNew()
              {
                  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 4 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

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

                      else if (position === 'vertical-right') {
                          drawer.css({
                              width: 0,
                              height: height,
                              display: 'block'
          Severity: Major
          Found in symphony/assets/js/src/symphony.drawer.js and 1 other location - About 4 hrs to fix
          symphony/assets/js/src/symphony.drawer.js on lines 63..110

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

          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 (position === 'vertical-left') {
                          drawer.css({
                              width: 0,
                              height: height,
                              display: 'block'
          Severity: Major
          Found in symphony/assets/js/src/symphony.drawer.js and 1 other location - About 4 hrs to fix
          symphony/assets/js/src/symphony.drawer.js on lines 82..110

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

          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']['navigation']['type'])) {
                      $li = new XMLElement('li');
                      $li->setAttribute('class', 'unique');
                      $li->setAttribute('data-type', 'type');
                      $li->appendChild(new XMLElement('header', '<h4>' . __('Page Type') . '</h4>'));
          Severity: Major
          Found in symphony/content/content.blueprintsdatasources.php and 1 other location - About 4 hrs to fix
          symphony/content/content.blueprintsdatasources.php on lines 536..546

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

          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']['navigation']['parent'])) {
                      $li = new XMLElement('li');
                      $li->setAttribute('class', 'unique');
                      $li->setAttribute('data-type', 'parent');
                      $li->appendChild(new XMLElement('header', '<h4>' . __('Parent Page') . '</h4>'));
          Severity: Major
          Found in symphony/content/content.blueprintsdatasources.php and 1 other location - About 4 hrs to fix
          symphony/content/content.blueprintsdatasources.php on lines 568..578

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

          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 field.checkbox.php has 362 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

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

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

                public function __viewIndex()
                {
                    $this->setPageType('table');
                    $this->setTitle(__('%1$s &ndash; %2$s', array(__('Authors'), __('Symphony'))));
            
            
            Severity: Major
            Found in symphony/content/content.systemauthors.php - About 4 hrs to fix

              Method __viewNew has 116 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function __viewNew()
                  {
                      $this->setPageType('form');
                      $this->setTitle(__('%1$s &ndash; %2$s', array(__('Sections'), __('Symphony'))));
                      $this->appendSubheading(__('Untitled'));
              Severity: Major
              Found in symphony/content/content.blueprintssections.php - About 4 hrs to fix

                Method exec has 115 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function exec($force_connection_method = null)
                    {
                        if ($force_connection_method !== self::FORCE_SOCKET && self::isCurlAvailable()) {
                            $ch = curl_init();
                
                
                Severity: Major
                Found in symphony/lib/toolkit/class.gateway.php - About 4 hrs to fix

                  Function fetch has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function fetch($id = null, $section_id = null, $order = 'ASC', $sortfield = 'sortorder', $type = null, $location = null, $where = null, $restrict = Field::__FIELD_ALL__)
                      {
                          if (Symphony::Log()) {
                              Symphony::Log()->pushDeprecateWarningToLog('FieldManager::fetch()', 'FieldManager::select()');
                          }
                  Severity: Minor
                  Found in symphony/lib/toolkit/class.fieldmanager.php - About 4 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