Showing 34 of 699 total issues

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

        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

            Function detectEmlChanges has a Cognitive Complexity of 8 (exceeds 5 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 45 mins 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 fetchEmlReport has a Cognitive Complexity of 7 (exceeds 5 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 35 mins 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

            Avoid too many return statements within this method.
            Open

                  return array();
            Severity: Major
            Found in modules/custom/pasta/lib/PastaApi.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                    return array();
              Severity: Major
              Found in modules/custom/pasta/lib/PastaApi.php - About 30 mins to fix

                Function processData has a Cognitive Complexity of 6 (exceeds 5 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 25 mins 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 getEntityFieldLangcodes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  public function getEntityFieldLangcodes($entity_type, $entity) {
                    list(, , $bundle) = entity_extract_ids($entity_type, $entity);
                    $instances = field_info_instances($entity_type, $bundle);
                    $langcodes = array();
                    foreach (array_keys($instances) as $field) {
                Severity: Minor
                Found in modules/custom/deims_d6_migration/migration/DeimsMigration.php - About 25 mins 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 deleteEml has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  public function deleteEml() {
                    list($scope, $identifier) = $this->dataSet->getPackageIDParts();
                    $url = static::getApiUrl("package/eml/$scope/$identifier");
                    $options = array(
                      'method' => 'DELETE',
                Severity: Minor
                Found in modules/custom/pasta/lib/PastaApi.php - About 25 mins 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