Showing 34 of 699 total issues

Function getUnitOptions has a Cognitive Complexity of 30 (exceeds 5 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 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 getUnits has a Cognitive Complexity of 24 (exceeds 5 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 3 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 __construct has 81 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

    Method getVariables has 76 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      public function getVariables($node, $row) {
        // We already have the array of referenced variable nodes in this row variable.
        // First filter out any NULL or empty values before proceeding.
        $variable_nids = array_filter($row->field_datafile_variable_ref);
        if (empty($variable_nids)) {

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

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

        Function processData has a Cognitive Complexity of 18 (exceeds 5 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 2 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 __construct has 53 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

          Function getVariables has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

            public function getVariables($node, $row) {
              // We already have the array of referenced variable nodes in this row variable.
              // First filter out any NULL or empty values before proceeding.
              $variable_nids = array_filter($row->field_datafile_variable_ref);
              if (empty($variable_nids)) {

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

            attach: function (context) {
          
              $('select.variable-type.autocomplete-item-process').each(function() {
                $(this).removeClass('autocomplete-item-process');
          
          
          Severity: Minor
          Found in modules/custom/deims_variable_search/js/field.js - About 1 hr to fix

            Function getProjectRoles has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

              public function getProjectRoles($node, $row) {
                $field_values = array();
            
                $roles = array(
                  'field_dataset_datamanager_ref' => 'data manager',

            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 fetchDOI has a Cognitive Complexity of 15 (exceeds 5 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

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