Skip to content
Snippets Groups Projects
Commit fad941cd authored by Gábor Hojtsy's avatar Gábor Hojtsy
Browse files

Merge branch '3425461-post-rector-report' into 'master-d11'

Resolve #3425461 "Post rector report"

See merge request !25
parents 1a25f1cf 4f04d083
No related branches found
No related tags found
No related merge requests found
Pipeline #127475 passed
{#
/**
* Available variables:
* - run: The drupalci run number that produced this patch.
* - run: The GitLab CI run number that produced this patch.
* - info_yml_updated: whether the current patch updates the info.yml file. It
will only be updated if the module will be Drupal 9 compatible.
* - drupal_rector_version: The version of drupal rector that was used to
......@@ -11,7 +11,7 @@
*/
#}
This is an automated patch generated using Upgrade Status and Drupal Rector. Please see the issue summary for more details. A merge request is also openend and updated.
This is an automated patch generated using Upgrade Status and Drupal Rector. Please see the issue summary for more details. A merge request (MR) is also openend and updated.
It is important that any automated tests available are run and that you manually test the changes.
......@@ -28,11 +28,15 @@ It is important that any automated tests available are run and that you manually
Therefore these changes <strong>did not update</strong> the <code>info.yml</code> file for Drupal 11 compatibility.
{% endif %}
Leaving this issue open, <strong>even after committing the current patch</strong>, will allow the <a href="/u/project-update-bot">Project Update Bot</a> to post additional Drupal 11 compatibility fixes as they become available in <a href="https://github.com/palantirnet/drupal-rector">Drupal Rector</a>.
{% if post_rector_results_posted %}
The compatibility issues that Upgrade Status found after the Drupal Rector fixes were applied are attached to help you resolve them manually.
{% endif %}
Leaving this issue open, <strong>even after committing the current patch or merging the MR</strong>, will allow the <a href="/u/project-update-bot">Project Update Bot</a> to post additional Drupal 11 compatibility fixes as they become available in <a href="https://github.com/palantirnet/drupal-rector">Drupal Rector</a>.
<h3>Debug info</h3>
<h3>Debug information</h3>
<div drupalcirun="{{ run }}}">Bot run #{{ run }}</div>
This patch was created using these packages:
These packages were used to generate the fixes:
{{ package_info|raw }}
......@@ -8,6 +8,7 @@
"nategood/httpful": "dev-PHP7.2_to_8.2",
"symfony/cache": "^5.0",
"composer/semver": "^1.5",
"dekor/php-array-table": "^2.0",
"ext-zip": "*",
"symfony/yaml": "^5.0",
"seld/cli-prompt": "^1.0",
......
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "ee8c7b8234bd4a722024033f05905f24",
"content-hash": "80143bd32870825372c94b005b8dd108",
"packages": [
{
"name": "behat/mink",
......@@ -220,6 +220,55 @@
],
"time": "2020-12-03T15:47:16+00:00"
},
{
"name": "dekor/php-array-table",
"version": "2.0",
"source": {
"type": "git",
"url": "https://github.com/deniskoronets/php-array-table.git",
"reference": "ca40b21ba84eee6a9658a33fc5f897d76baaf8e5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/deniskoronets/php-array-table/zipball/ca40b21ba84eee6a9658a33fc5f897d76baaf8e5",
"reference": "ca40b21ba84eee6a9658a33fc5f897d76baaf8e5",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"php": ">=5.6.0"
},
"require-dev": {
"phpunit/phpunit": "^10"
},
"type": "library",
"autoload": {
"psr-4": {
"dekor\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Denis Koronets",
"email": "deniskoronets@woo.zp.ua",
"homepage": "https://woo.zp.ua/"
}
],
"description": "PHP Library for printing associative arrays as text table (similar to mysql terminal console)",
"keywords": [
"library",
"php"
],
"support": {
"issues": "https://github.com/deniskoronets/php-array-table/issues",
"source": "https://github.com/deniskoronets/php-array-table/tree/2.0"
},
"time": "2023-02-10T10:13:42+00:00"
},
{
"name": "envms/fluentpdo",
"version": "v2.2.4",
......
......@@ -2,6 +2,7 @@
namespace RectorIssues\DrupalOrg;
use dekor\ArrayToTextTable;
use RectorIssues\Cache;
use RectorIssues\Config;
use RectorIssues\Settings;
......@@ -552,7 +553,46 @@ class IssueCreator extends IssueBase {
// Set to needs review.
$page->fillField('edit-field-issue-status-und', self::ISSUE_STATUS_NEEDS_REVIEW);
$comment_tokens['info_yml_updated'] = $this->updatedInfoYml($file_path);
$info_is_updated = $this->updatedInfoYml($file_path);
// If the info file was not updated, there are error left that we know.
$post_rector_txt_path = FALSE;
if (!$info_is_updated) {
// Upload the previous file first (done here, as Save would also
// upload it and avoid one extra HTTP request this way).
$page->pressButton('Upload');
// Look for the post_rector report results.
$files = glob(static::RESULTS_DIR . '/*/*.post_rector.xml');
if (!empty($files)) {
$txt_contents = '';
$post_rector_xml = simplexml_load_file($files[0]);
foreach($xml->checkstyle->file as $file_result) {
// Start a new section in the text for each file.
$file_path = wordwrap($file_result['name'], 80, "\n", TRUE);
$txt_contents .= $short_path . ":\n";
$table = [];
foreach ($rector_result->error as $error_result) {
$error_message = str_replace("\n", ' ', $error_result['message']);
$table[] = [
'severity' => wordwrap($error_result['severity'], 8, "\n", true),
'line' => wordwrap($error_result['line'], 7, "\n", true),
'message' => wordwrap($error_message . "\n", 60, "\n", true)
];
}
// Format found errors in an ASCII table.
$asciiRenderer = new ArrayToTextTable($table);
$txt_contents .= $asciiRenderer->render() . "\n";
}
// Save the resulting content in a temporary text file for upload.
$post_rector_txt_name = basename($files[0], '.xml') . '.txt';
$post_rector_txt_path = sys_get_temp_dir() . "/" . $post_rector_txt_name;
file_put_contents($post_rector_txt_path, $txt_contents);
}
}
$comment_tokens['info_yml_updated'] = $info_is_updated;
$comment_tokens['post_rector_results_posted'] = !empty($post_rector_txt_path);
$body = $this->getTemplateText('comment', $comment_tokens);
$page->fillField('edit-nodechanges-comment-comment-body-und-0-value', $body);
......@@ -561,9 +601,19 @@ class IssueCreator extends IssueBase {
$page->find('css', 'input.form-file')->setValue($diff_file);
$page->pressButton('Upload');
}
// Add the actual diff file as well.
$page->find('css', 'input.form-file')->setValue($file_path);
if (!empty($post_rector_txt_path)) {
// Upload the previous file first (done here, as Save would also
// upload it and avoid one extra HTTP request this way).
$page->pressButton('Upload');
// Upload the post-rector report file.
$page->find('css', 'input.form-file')->setValue($post_rector_txt_path);
}
// Save the comment (and upload the last file as well).
$page->pressButton('Save');
$this->debugOutput();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment