modules/custom/deims_d6_migration/migration/DeimsContentDataSetMigration.php

Summary

Maintainability
B
5 hrs
Test Coverage

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,

    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

    Comments may not appear after statements
    Open

          'field_dataset_ext_assoc_ref', // Handled in prepare()

    Missing function doc comment
    Open

      public function getProjectRoles($node, $row) {

    Expected one space after the comma, 0 found
    Open

        if(!$connection->schema()->fieldExists('content_type_data_file','field_data_file_data_set_nid')){

    Expected newline after closing brace
    Open

        }else{

    Expected 1 space after closing parenthesis; found 0
    Open

        if(!$connection->schema()->fieldExists('content_type_data_file','field_data_file_data_set_nid')){

    No space found before comment text; expected "// $this->addFieldMapping('field_keywords', '9');" but found "//$this->addFieldMapping('field_keywords', '9');"
    Open

        //$this->addFieldMapping('field_keywords', '9');

    Expected 1 space after IF keyword; 0 found
    Open

        if(!$connection->schema()->fieldExists('content_type_data_file','field_data_file_data_set_nid')){

    Expected 1 blank line after function; 0 found
    Open

      }

    No space found before comment text; expected "// $this->addFieldMapping('field_core_areas', '1');" but found "//$this->addFieldMapping('field_core_areas', '1');"
    Open

        //$this->addFieldMapping('field_core_areas', '1');

    Inline comments must end in full-stops, exclamation marks, colons, question marks, or closing parentheses
    Open

        //$this->addFieldMapping('field_keywords', '9');

    Inline comments must end in full-stops, exclamation marks, colons, question marks, or closing parentheses
    Open

        //  ->sourceMigration('DeimsContentBiblioMigration');

    Comments may not appear after statements
    Open

          'field_dataset_fieldcrew_ref', // Handled in prepare()

    Comments may not appear after statements
    Open

          'field_dataset_datamanager_ref', // Handled in prepare()

    Missing function doc comment
    Open

      public function prepareRow($row) {

    The closing brace for the class must have an empty line before it
    Open

    }

    Expected 1 space after ELSE keyword; 0 found
    Open

        }else{

    Comments may not appear after statements
    Open

          'field_dataset_labcrew_ref', // Handled in prepare()

    Missing class doc comment
    Open

    class DeimsContentDataSetMigration extends DrupalNode6Migration {

    If the line declaring an array spans longer than 80 characters, each element should be broken into its own line
    Open

      protected $dependencies = array('DeimsContentDataFile', 'DeimsContentPerson', 'DeimsContentResearchSite');

    No space found before comment text; expected "// $this->addFieldMapping('field_related_publications', 'field_dataset_biblio_ref')" but found "//$this->addFieldMapping('field_related_publications', 'field_dataset_biblio_ref')"
    Open

        //$this->addFieldMapping('field_related_publications', 'field_dataset_biblio_ref')

    Missing function doc comment
    Open

      public function __construct(array $arguments) {

    Inline comments must end in full-stops, exclamation marks, colons, question marks, or closing parentheses
    Open

        //$this->addFieldMapping('field_core_areas', '1');

    Missing function doc comment
    Open

      public function prepare($node, $row) {

    There are no issues that match your filters.

    Category
    Status