Showing 699 of 699 total issues

Method __construct has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public function __construct(array $arguments) {
    $arguments += array(
      'description' => '',
      'source_connection' => 'drupal6',
      'source_version' => 6,

    Function getUnitStmml has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

      public static function getUnitStmml($unit, $use_cache = FALSE) {
        $stmml = NULL;
        $dom = new DOMDocument();
    
        try {
    Severity: Minor
    Found in modules/custom/lter_unit/lib/LterUnitStmmlHelper.php - About 1 hr 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 prepareEntityTranslations has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

      public function prepareEntityTranslations($entity_type, $entity) {
        if (entity_translation_enabled($entity_type)) {
          if ($handler = entity_translation_get_handler($entity_type, $entity)) {
    
            // Fetch all the languages that have field data for this entity.
    Severity: Minor
    Found in modules/custom/deims_d6_migration/migration/DeimsMigration.php - About 1 hr 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 getUnitOptions has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      public static function getUnitOptions($category_minimum = 0) {
        $results = &drupal_static(__FUNCTION__);
    
        if (!isset($results)) {
          $cid = 'unit-options:' . $GLOBALS['language']->language;
    Severity: Minor
    Found in modules/custom/lter_unit/lib/LterUnitHelper.php - About 1 hr to fix

      Method __construct has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        public function __construct($arguments) {
          parent::__construct($arguments);
      
          $this->connection = Database::getConnection('default', 'drupal6');
      
      

        Method processData has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          public static function processData(&$data) {
            try {
              if ($node = node_load($data['nid'])) {
                $dataset = new EmlDataSet($node);
                $pasta = new PastaApi($dataset);
        Severity: Minor
        Found in modules/custom/pasta/lib/PastaSubmissionQueue.php - About 1 hr to fix

          Function getCustomUnitMetadata has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

            public function getCustomUnitMetadata() {
              $nids = FieldHelper::getValues('node', $this->node, 'field_data_sources', 'target_id');
              $sources = node_load_multiple($nids);
          
              $custom_units = array();
          Severity: Minor
          Found in modules/custom/eml/lib/EmlDataSet.php - About 1 hr 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 getUnits has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            public static function getUnits() {
              $units = &drupal_static(__FUNCTION__);
          
              if (!isset($units)) {
                $cid = 'units:scope=2';
          Severity: Minor
          Found in modules/custom/lter_unit/lib/LterUnitHelper.php - About 1 hr to fix

            Method getUnitStmml has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              public static function getUnitStmml($unit, $use_cache = FALSE) {
                $stmml = NULL;
                $dom = new DOMDocument();
            
                try {
            Severity: Minor
            Found in modules/custom/lter_unit/lib/LterUnitStmmlHelper.php - About 1 hr to fix

              Function prepare has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                public function prepare($object, $row) {
                  // Note there is no parent::prepare($object, $row) here since there is no
                  // parent to call.
              
                  // Apply entity-generic alterations before the entity object is saved.
              Severity: Minor
              Found in modules/custom/deims_d6_migration/migration/DeimsMigration.php - About 1 hr 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 detectEmlChanges has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                public function detectEmlChanges($check_unpublished = TRUE) {
                  if ($check_unpublished && $this->node->status != NODE_PUBLISHED) {
                    eml_debug("Skipping detectEmlChanges() since node @nid is not published.", array('@nid' => $this->node->nid));
                    return FALSE;
                  }
              Severity: Minor
              Found in modules/custom/eml/lib/EmlDataSet.php - About 1 hr to fix

                Method prepareRow has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  public function prepareRow($row) {
                    parent::prepareRow($row);
                
                    // Convert values from 'Yes' and 'No' to integers 1 and 0, respectively.
                    $row->field_person_list = (!empty($row->field_person_list) && $row->field_person_list == 'Yes' ? 1 : 0);

                  Method processData has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    public static function processData($data) {
                      $seen_nids = &drupal_static('pasta_validation_report_queue_process', array());
                  
                      // Ensure that on the same request we don't try to fetch the validation
                      // report for the same node more than once.
                  Severity: Minor
                  Found in modules/custom/pasta/lib/PastaValidationReportQueue.php - About 1 hr to fix

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

                              $(this).parents('.variable-entry').find('select[name="' + base + '[type]"]').val(ui.item.type).change().data('autocomplete-item', ui.item).addClass('autocomplete-item-process');
                    Severity: Major
                    Found in modules/custom/deims_variable_search/js/field.js and 1 other location - About 1 hr to fix
                    modules/custom/deims_variable_search/js/field.js on lines 19..19

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

                    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

                                $(this).parents('.variable-entry').find('select[name="' + base + '[data][unit][select]"]').val(item.data.unit).change().trigger('liszt:updated');
                    Severity: Major
                    Found in modules/custom/deims_variable_search/js/field.js and 1 other location - About 1 hr to fix
                    modules/custom/deims_variable_search/js/field.js on lines 51..51

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

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

                      public function prepareRow($row) {
                        parent::prepareRow($row);
                    
                        // Convert values from 'Yes' and 'No' to integers 1 and 0, respectively.
                        $row->field_person_list = (!empty($row->field_person_list) && $row->field_person_list == 'Yes' ? 1 : 0);

                    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 fetchEmlReport has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      public function fetchEmlReport() {
                    
                        list($scope, $identifier, $revision) = $this->dataSet->getPackageIDParts();
                    
                        // Fetch the EML report from the API.
                    Severity: Minor
                    Found in modules/custom/pasta/lib/PastaApi.php - About 1 hr to fix

                      Method fetchDOI has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        public function fetchDOI() {
                          list($scope, $identifier, $revision) = $this->dataSet->getPackageIDParts();
                      
                          $url = static::getApiUrl("package/doi/eml/{$scope}/{$identifier}/{$revision}");
                          $request = drupal_http_request($url, array('timeout' => 10));
                      Severity: Minor
                      Found in modules/custom/pasta/lib/PastaApi.php - About 1 hr to fix

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

                                  $(this).parents('.variable-entry').find('textarea[name="' + base + '[data][codes][options_field]"]').val(item.data.codes_text).trigger('manual-change');
                        Severity: Major
                        Found in modules/custom/deims_variable_search/js/field.js and 1 other location - About 1 hr to fix
                        modules/custom/deims_variable_search/js/field.js on lines 50..50

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

                        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

                                  $(this).parents('.variable-entry').find('textarea[name="' + base + '[missing_values][options_field]"]').val(ui.item.missing_values_text).trigger('manual-change');
                        Severity: Major
                        Found in modules/custom/deims_variable_search/js/field.js and 1 other location - About 1 hr to fix
                        modules/custom/deims_variable_search/js/field.js on lines 35..35

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

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language