- Issue created by @dineshkumarbollu
- Issue was unassigned.
- Status changed to Needs review
almost 2 years ago 4:42am 18 April 2023 - Status changed to Needs work
almost 2 years ago 3:10pm 20 April 2023 - šµšPhilippines clarkssquared
Hi dineshkumarbollu
I applied your patch #2, some phpcs errors and warnings were fixed but there are still remaining phpcs warnings being flagged.
Please look at the screenshots attached for your reference
Thanks
- š·šŗRussia sorlov
I'm not sure that we'd pass README.md to phpcs.
It makes no sense, as it is just plain text doc.
- Status changed to Needs review
almost 2 years ago 5:37am 4 May 2023 - š·šŗRussia sorlov
Here is patch version without changes in README files
- Status changed to Needs work
almost 2 years ago 8:22am 4 May 2023 - š®š¹Italy apaderno Brescia, š®š¹
Actually,
phpcs
handles also the README files. What reported byphpcs
for a REAME.txt or README.md file needs to be fixed too, if what reported is correct. - š·šŗRussia sorlov
What is the point to run PHP CODE SNIFFER on readme text files?
There is no code inside, just readme text.
- Status changed to Needs review
almost 2 years ago 12:48pm 4 May 2023 - š®š³India Rajan Kumar
Attached patch for fix phpcs errors which also remove README.md file warnings.
- š®š¹Italy apaderno Brescia, š®š¹
Coding standards are also for the README files, not just files containing code.
- Status changed to RTBC
almost 2 years ago 2:04pm 4 May 2023 - šµšPhilippines clarkssquared
Hi @Rajan Kumar,
I applied your patch #10 to my local and confirmed that all PHPCS issues/erros were fixed.
Kindly look at the screenshots attached for your reference
Thank you.
- Status changed to Needs work
almost 2 years ago 4:00pm 4 May 2023 - š®š¹Italy apaderno Brescia, š®š¹
-Where %arg - absolute path to directory with source .csv files. All source files should be placed there without any subfolders. +Where %arg - absolute path to directory with source .csv files. All source + files should be placed there without any subfolders.
The last line does not need to start with a space.
- - **address** (we can use various properties like country_code, locality, postal_code, etc.) + - **address** (we can use various properties like country_code, locality, + postal_code, etc.)
The last line must be indented.
------------ -## Administration +## Drush command
Why is the header changed?
-1. Provide proper settings on /admin/config/content/migrate-generator-export page. +`drush migrate_generator:generate_migrations %arg %options` -2. Create neccessary configuration export entities on /admin/config/content/migrate-generator-export/types page. -For each entity type and bundle we may have configuration. which will be used for export. -This configuration may have fields, which will be included in export. +Where %arg - absolute path to directory with source .csv files. All source files +should be placed there without any subfolders. -3. Perform export on /admin/content/migrate-generator-export page. -There is field `Include all referenced content`. With this field checked, module will export also content, - related via entity reference fields, if any of them are included in export. +Also we have next possible options: +* pattern - + Pattern for source CSV files. Defaults to '*.csv'. +* delimiter - + Delimiter for source CSV files. Defaults to ; +* enclosure - + Enclosure for source CSV files. Defaults to " +* values_delimiter - + Delimiter for multi-valued fields. Defaults to | +* date_format - + Date format used in CSV. Defaults to "d-m-Y H:i:s" +* update - + Update previously-generated migrations. +* migrate_group - + Migration Group Id. Defaults to "mgg"
Why is that part changed? The
phpcs
report does not suggest such a change. - Status changed to Needs review
over 1 year ago 11:24am 23 June 2023 - š®š³India sakthi_dev
Created a patch by addressing the changes in comment #13. Please review.
- Status changed to Needs work
over 1 year ago 3:32pm 23 June 2023 - š®š¹Italy apaderno Brescia, š®š¹
+This command creates Migration for each source file and Migration Group for + these created migrations. +Migration group ID can be specified by **migrate_group** option in +drush command.
The sentence starting with Migration group ID does not need its own line.
Then, since that text is edited, drush should be replaced by Drush.- You can see some examples in /example folder of this module, like `node-basic_page.csv`, `taxonomy_term-category.csv`, `user.csv`, etc. + You can see some examples in /example folder of this module, like + `node-basic_page.csv`, `taxonomy_term-category.csv`, `user.csv`, etc.
-* Each source file should have first column filled with Ids. It will be used as unique identifier for source row only, not for Id of migrated entity. +* Each source file should have first column filled with Ids. It will be used + as unique identifier for source row only, not for Id of migrated entity.
-For example, `body/value`, `body/format`, `date/value`, `date/end_value`, `price/number`, `price/currency_code`, etc. +For example, `body/value`, `body/format`, `date/value`, `date/end_value`, + `price/number`, `price/currency_code`, etc.
There is an extra space at the beginning of the last line.
- ...| image/alt | image/title | image/target_id | ...| - ---| --- | --- | --- | --- | - ...| Alt text | Image title | https://www.drupal.org/files/cta/graphic/Wordmark_blue_RGB.png | ... | - + | ... | image/alt | image/title | + image/target_id | ... | + | --- | --------- | ----------- | + -------------------------------------------------------------- | --- | + | ... | Alt text | Image title | + https://www.drupal.org/files/cta/graphic/Wordmark_blue_RGB.png | ... |
That is markup for a table and should not be changed.
-1. Paragraph field in Basic Page CT could have references to WYSIWYG and Media paragraphs. -so we will have separate sources for these paragraphs `paragraph-media.csv`, `paragraph-wysiwyg.csv` +1. Paragraph field in Basic Page CT could have references to WYSIWYG and + Media paragraphs. +so we will have separate sources for these paragraphs +`paragraph-media.csv`, `paragraph-wysiwyg.csv`
That text is not correctly formatted.
- Assigned to nitin_lama
- Status changed to Needs review
over 1 year ago 11:43am 27 June 2023 - Issue was unassigned.
- š®š³India Yashaswi18
Tried applying the patch provided in #19, throws error.
- š·šŗRussia sorlov
@Yashaswi18 can you give more info?
what version of module do you use and what error do you have?
- š®š³India Yashaswi18
Version: 8.x-1.x
Error:
Checking patch README.md... error: while searching for: * migrate_group - Migration Group Id. Defaults to "mgg" This command creates Migration for each source file and Migration Group for these created migrations. Migration group ID can be specified by **migrate_group** option in drush command. ## CSV file structure and contents We should use next ways of organizing source files: * Source CSV files should have following filename pattern `{entity_type}-{bundle}.csv` or `{entity_type}.csv`. You can see some examples in /example folder of this module, like `node-basic_page.csv`, `taxonomy_term-category.csv`, `user.csv`, etc. **Main idea here - to identify target Entity type and Bundle for source file.** There are some rules for structure and content of source csv file: * Each source file should have first column filled with Ids. It will be used as unique identifier for source row only, not for Id of migrated entity. * All other columns should be named with exact field's machine name. * For boolean fields you can use "1/0" or "true/false" values. * For list fields, we should have key values in source csv, not labels. * Fields with multiple values should have strict delimiter. `|` for example. This delimiter can be specified by **values_delimiter** option in drush command. * Date fields should have same date format everywhere in sources. This date format can be specified by **date_format** option in drush command. No timezone conversion is made for dates. ## Complex fields with multiple properties For complex fields (like Formatted text, Link, Datetime Range, Address, Price, etc.) we can have several properties in source file. In this case, you can use `/` separator in column name for these cases. Supported complex field types: error: patch failed: README.md:28 error: README.md: patch does not apply Checking patch migrate_generator_export/README.md... error: while searching for: # migrate_generator_export Module to generate source CSV files to be processed by migrate_generator ## Basic idea Main idea here is to **provide funcionality for generating source csv files**. ------------ ## Administration error: patch failed: migrate_generator_export/README.md:1 error: migrate_generator_export/README.md: patch does not apply Checking patch migrate_generator_export/src/Commands/DrushCommands.php... error: while searching for: continue; } $fields = $export_config->getFields(); list($entity_type_id, $bundle_id) = explode('--', $export_config_id); $this->exportManager->getOperations($batch['operations'], $entity_type_id, $bundle_id, $fields, NULL, TRUE, $options['folder'] ?? ''); } if (empty($batch['operations'])) { error: patch failed: migrate_generator_export/src/Commands/DrushCommands.php:203 error: migrate_generator_export/src/Commands/DrushCommands.php: patch does not apply Checking patch migrate_generator_export/src/ExportManager.php... Hunk #1 succeeded at 72 (offset -10 lines). Hunk #2 succeeded at 96 (offset -10 lines). Hunk #3 succeeded at 240 (offset -15 lines). Checking patch migrate_generator_export/src/FieldsExportManager.php... yashaswi@LAPTOP-V6R99U45:~/contribs/migrate_generator$ */ public function getFieldsValues(ContentEntityInterface $entity, array $fields, array $options) { $values = []; foreach ($fields as $field) { $field_sub_value_name = ''; if (strpos($field, '-') !== FALSE) { list($field_name, $field_sub_value_name) = explode('-', $field); } if (!empty($field_sub_value_name)) { $field = $field_name; error: patch failed: migrate_generator_export/src/FieldsExportManager.php:53 error: migrate_generator_export/src/FieldsExportManager.php: patch does not apply Checking patch migrate_generator_export/src/Form/EntityTypeExportConfigForm.php... Checking patch migrate_generator_export/src/Form/ExportForm.php... error: while searching for: 'finished' => 'Drupal\migrate_generator_export\ExportManager::batchFinished', ]; $storage = $this->entityTypeManager->getStorage('entity_type_export_config'); foreach (Checkboxes::getCheckedCheckboxes($exports) as $export_id) { $export = $storage->load($export_id); if (!empty($export)) { $fields = $export->getFields(); list($entity_type_id, $bundle_id) = explode('--', $export_id); $this->exportManager->getOperations($batch['operations'], $entity_type_id, $bundle_id, $fields, NULL, FALSE, $form_state->getValue('folder') ?? ''); } } if (empty($batch['operations'])) { error: patch failed: migrate_generator_export/src/Form/ExportForm.php:194 error: migrate_generator_export/src/Form/ExportForm.php: patch does not apply Checking patch migrate_generator_export/src/Plugin/GeneratorExportPluginDateBase.php... Checking patch migrate_generator_export/src/Plugin/migrate_generator_export/process/FileExport.php... error: while searching for: if ($entity->get($field_name)->isEmpty()) { return ''; } $file_format = isset($this->options['file_format']) ? $this->options['file_format'] : 'url'; $field_values = $entity->get($field_name)->getValue(); $value = []; $file_storage = $this->entityTypeManager->getStorage('file'); error: patch failed: migrate_generator_export/src/Plugin/migrate_generator_export/process/FileExport.php:60 error: migrate_generator_export/src/Plugin/migrate_generator_export/process/FileExport.php: patch does not apply Checking patch src/Plugin/GeneratorProcessPluginBase.php... Checking patch src/Plugin/GeneratorProcessPluginDateBase.php... Checking patch src/Plugin/migrate/process/IpToBinary.php... error: while searching for: use Drupal\migrate\Row; /** * @MigrateProcessPlugin( * id = "ip_to_binary", * handle_multiples = false error: patch failed: src/Plugin/migrate/process/IpToBinary.php:8 error: src/Plugin/migrate/process/IpToBinary.php: patch does not apply
- š·šŗRussia sorlov
Tried to apply patch from #19 to latest 8.x-1.x version and got no errors
- Status changed to Needs work
9 months ago 11:16am 24 May 2024 - šµšPhilippines cleavinjosh
Hi @sorlov,
I applied patch #19 to 8.x-1.x-dev and it was applied smoothly.
However, when I ran
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml
, I still encountered some issues.ā migrate_generator git:(8.x-1.6) curl https://www.drupal.org/files/issues/2023-09-18/phpcs-3354780-19.patch | patch -p1 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 24849 100 24849 0 0 97920 0 --:--:-- --:--:-- --:--:-- 98217 patching file README.md patching file migrate_generator_export/README.md patching file migrate_generator_export/src/Commands/DrushCommands.php patching file migrate_generator_export/src/ExportManager.php patching file migrate_generator_export/src/FieldsExportManager.php patching file migrate_generator_export/src/Form/EntityTypeExportConfigForm.php patching file migrate_generator_export/src/Form/ExportForm.php patching file migrate_generator_export/src/Plugin/GeneratorExportPluginDateBase.php patching file migrate_generator_export/src/Plugin/migrate_generator_export/process/FileExport.php patching file src/Plugin/GeneratorProcessPluginBase.php patching file src/Plugin/GeneratorProcessPluginDateBase.php patching file src/Plugin/migrate/process/IpToBinary.php ā migrate_generator git:(8.x-1.6) ā .. ā contrib git:(main) ā phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml migrate_generator FILE: /Users/interns/Demo-site/drupal-orgissue/web/modules/contrib/migrate_generator/README.md ---------------------------------------------------------------------------------------------- FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE ---------------------------------------------------------------------------------------------- 120 | WARNING | Line exceeds 80 characters; contains 105 characters ---------------------------------------------------------------------------------------------- FILE: /Users/interns/Demo-site/drupal-orgissue/web/modules/contrib/migrate_generator/migrate_generator_export/README.md ----------------------------------------------------------------------------------------------------------------------- FOUND 0 ERRORS AND 10 WARNINGS AFFECTING 10 LINES ----------------------------------------------------------------------------------------------------------------------- 12 | WARNING | Line exceeds 80 characters; contains 82 characters 14 | WARNING | Line exceeds 80 characters; contains 112 characters 15 | WARNING | Line exceeds 80 characters; contains 89 characters 19 | WARNING | Line exceeds 80 characters; contains 106 characters 30 | WARNING | Line exceeds 80 characters; contains 156 characters 35 | WARNING | Line exceeds 80 characters; contains 85 characters 40 | WARNING | Line exceeds 80 characters; contains 93 characters 45 | WARNING | Line exceeds 80 characters; contains 121 characters 50 | WARNING | Line exceeds 80 characters; contains 93 characters 53 | WARNING | Line exceeds 80 characters; contains 86 characters ----------------------------------------------------------------------------------------------------------------------- FILE: /Users/interns/Demo-site/drupal-orgissue/web/modules/contrib/migrate_generator/migrate_generator_export/src/GeneratorExportPluginManager.php -------------------------------------------------------------------------------------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE -------------------------------------------------------------------------------------------------------------------------------------------------- 8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Component\Plugin\FallbackPluginManagerInterface. -------------------------------------------------------------------------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY -------------------------------------------------------------------------------------------------------------------------------------------------- FILE: /Users/interns/Demo-site/drupal-orgissue/web/modules/contrib/migrate_generator/migrate_generator_export/src/Plugin/GeneratorExportPluginInterface.php ----------------------------------------------------------------------------------------------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE ----------------------------------------------------------------------------------------------------------------------------------------------------------- 6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Component\Plugin\PluginInspectionInterface. ----------------------------------------------------------------------------------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY ----------------------------------------------------------------------------------------------------------------------------------------------------------- FILE: /Users/interns/Demo-site/drupal-orgissue/web/modules/contrib/migrate_generator/migrate_generator_export/src/Commands/DrushCommands.php -------------------------------------------------------------------------------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE -------------------------------------------------------------------------------------------------------------------------------------------- 77 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter -------------------------------------------------------------------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY -------------------------------------------------------------------------------------------------------------------------------------------- FILE: /Users/interns/Demo-site/drupal-orgissue/web/modules/contrib/migrate_generator/migrate_generator_export/src/FieldsExportManager.php --------------------------------------------------------------------------------------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE --------------------------------------------------------------------------------------------------------------------------------------------------- 6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Component\Plugin\Exception\PluginNotFoundException. --------------------------------------------------------------------------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY --------------------------------------------------------------------------------------------------------------------------------------------------- FILE: /Users/interns/Demo-site/drupal-orgissue/web/modules/contrib/migrate_generator/src/Plugin/GeneratorProcessPluginBase.php ------------------------------------------------------------------------------------------------------------------------------ FOUND 1 ERROR AFFECTING 1 LINE ------------------------------------------------------------------------------------------------------------------------------ 8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Psr\Log\LoggerInterface. ------------------------------------------------------------------------------------------------------------------------------ PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY ------------------------------------------------------------------------------------------------------------------------------ FILE: /Users/interns/Demo-site/drupal-orgissue/web/modules/contrib/migrate_generator/src/GeneratorProcessPluginManager.php ------------------------------------------------------------------------------------------------------------------------------------------------ FOUND 1 ERROR AFFECTING 1 LINE ------------------------------------------------------------------------------------------------------------------------------------------------ 8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Component\Plugin\FallbackPluginManagerInterface. ------------------------------------------------------------------------------------------------------------------------------------------------ PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY ------------------------------------------------------------------------------------------------------------------------------------------------ FILE: /Users/interns/Demo-site/drupal-orgissue/web/modules/contrib/migrate_generator/src/Scanner.php -------------------------------------------------------------------------------------------------------------------------------- FOUND 3 ERRORS AFFECTING 2 LINES -------------------------------------------------------------------------------------------------------------------------------- 7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Entity\EntityFieldManager. 60 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter 60 | ERROR | [x] The closing parenthesis of a multi-line function declaration must be on a new line -------------------------------------------------------------------------------------------------------------------------------- PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY -------------------------------------------------------------------------------------------------------------------------------- FILE: /Users/interns/Demo-site/drupal-orgissue/web/modules/contrib/migrate_generator/src/Commands/DrushCommands.php --------------------------------------------------------------------------------------------------------------------------- FOUND 5 ERRORS AFFECTING 3 LINES --------------------------------------------------------------------------------------------------------------------------- 6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\migrate_generator\Scanner. 70 | ERROR | [x] The first parameter of a multi-line function declaration must be on the line after the opening bracket 70 | ERROR | [x] Multi-line function declarations must define one parameter per line 78 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter 78 | ERROR | [x] The closing parenthesis of a multi-line function declaration must be on a new line --------------------------------------------------------------------------------------------------------------------------- PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY --------------------------------------------------------------------------------------------------------------------------- FILE: /Users/interns/Demo-site/drupal-orgissue/web/modules/contrib/migrate_generator/src/Generator.php ------------------------------------------------------------------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE ------------------------------------------------------------------------------------------------------------------------------- 10 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\migrate_plus\Entity\Migration. ------------------------------------------------------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY ------------------------------------------------------------------------------------------------------------------------------- Time: 978ms; Memory: 12MB ā contrib git:(main) ā
Thank you.
- š®š³India dev16.addweb
Hi,
I have fixed the issue mentioned in #24. Please review the attached patch. - Status changed to Needs review
8 months ago 5:48am 10 June 2024