GemsTracker/gemstracker-library

View on GitHub

Showing 4,260 of 4,272 total issues

Function loadFormData has a Cognitive Complexity of 84 (exceeds 5 allowed). Consider refactoring.
Open

    protected function loadFormData()
    {
        parent::loadFormData();

        if ($this->createData && ($this->request->isPost() && (! isset($this->formData[$this->saveButtonId])))) {
Severity: Minor
Found in classes/Gems/Snippets/Respondent/RespondentFormSnippet.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 RespondentModel.php has 723 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

use Gems\Exception\RespondentAlreadyExists;

/**
Severity: Major
Found in classes/Gems/Model/RespondentModel.php - About 1 day to fix

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

        public function matchActivity($name, $organizationId, $create = true)
        {
            $cacheId = __CLASS__ . '_' . __FUNCTION__;
            $matches = $this->cache->load($cacheId);
    
    
    Severity: Major
    Found in classes/Gems/Agenda.php and 1 other location - About 1 day to fix
    classes/Gems/Agenda.php on lines 1381..1423

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

    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

        public function matchProcedure($name, $organizationId, $create = true)
        {
            $cacheId = __CLASS__ . '_' . __FUNCTION__;
            $matches = $this->cache->load($cacheId);
    
    
    Severity: Major
    Found in classes/Gems/Agenda.php and 1 other location - About 1 day to fix
    classes/Gems/Agenda.php on lines 1195..1237

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

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

    <?php
    
    /**
     *
     * @package    Gems
    Severity: Major
    Found in classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php - About 1 day to fix

      Gems_Project_ProjectSettings has 79 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Gems_Project_ProjectSettings extends \ArrayObject
      {
          /**
           * The db adapter for the responses
           *
      Severity: Major
      Found in classes/Gems/Project/ProjectSettings.php - About 1 day to fix

        GemsEscort has 77 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class GemsEscort extends \MUtil_Application_Escort
        {
            /**
             * Default reception code value
             */
        Severity: Major
        Found in classes/GemsEscort.php - About 1 day to fix

          Function processForm has a Cognitive Complexity of 72 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function processForm($saveLabel = null, $data = null)
              {
                  $model   = $this->getModel();
                  $mname   = $model->getName();
                  $request = $this->getRequest();
          Severity: Minor
          Found in classes/Gems/Controller/BrowseEditAction.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 MenuAbstract.php has 628 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          /**
           *
           * @package    Gems
          Severity: Major
          Found in classes/Gems/Menu/MenuAbstract.php - About 1 day to fix

            File SubMenuItem.php has 625 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            /**
             *
             * @package    Gems
            Severity: Major
            Found in classes/Gems/Menu/SubMenuItem.php - About 1 day to fix

              File Form.php has 623 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              /**
               * Helper for OpenRosa forms
               *
               * It supports a subset of OpenRosa forms and provides a bridge between GemsTracker
              Severity: Major
              Found in classes/OpenRosa/Tracker/Source/Form.php - About 1 day to fix

                File UpgradeCompatibilitySnippet.php has 601 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                
                /**
                 *
                 * @package    Gems
                Severity: Major
                Found in classes/Gems/Snippets/Upgrade/UpgradeCompatibilitySnippet.php - About 1 day to fix

                  Function addRowWithCount has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function addRowWithCount($row, $writer, $rowNumber)
                      {
                          $exportRow   = $this->filterRow($row);
                          $labeledCols = $this->getLabeledColumns();
                          $exportRow   = array_replace(array_flip($labeledCols), $exportRow);
                  Severity: Minor
                  Found in classes/Gems/Export/StreamingStataExport.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

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

                      public function getSqlWhereBoth($toApps)
                      {
                          $appWheres = array();
                          $epiWheres = array();
                  
                  Severity: Major
                  Found in classes/Gems/Agenda/Filter/AndAppointmentFilter.php and 1 other location - About 1 day to fix
                  classes/Gems/Agenda/Filter/OrAppointmentFilter.php on lines 37..91

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

                  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

                      public function getSqlWhereBoth($toApps)
                      {
                          $appWheres = array();
                          $epiWheres = array();
                  
                  Severity: Major
                  Found in classes/Gems/Agenda/Filter/OrAppointmentFilter.php and 1 other location - About 1 day to fix
                  classes/Gems/Agenda/Filter/AndAppointmentFilter.php on lines 37..91

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

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

                      public function render($content)
                      {
                          $useBootstrap = \MUtil_Bootstrap::enabled();
                  
                          if ((null === ($element = $this->getElement())) ||
                  Severity: Minor
                  Found in classes/Gems/Form/Decorator/Tabs.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 TrackEngineAbstract.php has 590 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  
                  /**
                   *
                   * @package    Gems
                  Severity: Major
                  Found in classes/Gems/Tracker/Engine/TrackEngineAbstract.php - About 1 day to fix

                    Method addRespondentPage has 248 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function addRespondentPage($label)
                        {
                            $orgId = $this->currentUser->getCurrentOrganizationId();
                    
                            $params = array(\MUtil_Model::REQUEST_ID1  => 'gr2o_patient_nr', \MUtil_Model::REQUEST_ID2 => 'gr2o_id_organization');
                    Severity: Major
                    Found in classes/Gems/Menu.php - About 1 day to fix

                      File StepEngineAbstract.php has 573 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      <?php
                      
                      /**
                       *
                       * @package    Gems
                      Severity: Major
                      Found in classes/Gems/Tracker/Engine/StepEngineAbstract.php - About 1 day to fix

                        File BrowseEditAction.php has 564 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        <?php
                        
                        /**
                         *
                         * @package    Gems
                        Severity: Major
                        Found in classes/Gems/Controller/BrowseEditAction.php - About 1 day to fix
                          Severity
                          Category
                          Status
                          Source
                          Language