From 8071a58891e8ff560c9b59775b2809687ec128cc Mon Sep 17 00:00:00 2001 From: James Shields <57457-lostcarpark@users.noreply.drupalcode.org> Date: Fri, 8 Mar 2024 13:18:55 +0000 Subject: [PATCH] Issue #3419925: Gitlab CI - PHPCS - Long lines --- .../ProjectBrowserSource/RandomDataPlugin.php | 5 ++-- .../ProjectBrowserSourceExample.php | 4 +-- src/Commands/UpdateFixtureCommands.php | 7 +++--- src/Controller/BrowserController.php | 3 ++- src/Controller/InstallerController.php | 23 +++++++++++------ .../ProjectBrowserEndpointController.php | 3 ++- .../ProjectBrowserSource/MockDrupalDotOrg.php | 12 +++++---- src/ProjectBrowserFixtureHelper.php | 11 ++++---- .../DrupalDotOrgJsonApi.php | 3 ++- .../Functional/InstallerControllerTest.php | 4 +-- tests/src/Functional/ProjectBrowserTest.php | 2 +- .../ProjectBrowserInstallerUiTest.php | 4 +-- .../ProjectBrowserUiTest.php | 10 +++++--- .../ProjectBrowserUiTestJsonApi.php | 11 +++++--- .../TranslatedSvelteAppTest.php | 4 +-- .../Unit/ProjectBrowserFixtureHelperTest.php | 25 ++++++++++++++++--- 16 files changed, 86 insertions(+), 45 deletions(-) diff --git a/modules/project_browser_devel/src/Plugin/ProjectBrowserSource/RandomDataPlugin.php b/modules/project_browser_devel/src/Plugin/ProjectBrowserSource/RandomDataPlugin.php index 5273f92b2..d7736513a 100644 --- a/modules/project_browser_devel/src/Plugin/ProjectBrowserSource/RandomDataPlugin.php +++ b/modules/project_browser_devel/src/Plugin/ProjectBrowserSource/RandomDataPlugin.php @@ -13,8 +13,9 @@ use Symfony\Component\DependencyInjection\ContainerInterface; /** * Random data plugin. Used mostly for testing. * - * To enable this source: - * - `drush config:set project_browser.admin_settings enabled_source random_data` + * To enable this source use the following drush command. + * phpcs:ignore + * drush config:set project_browser.admin_settings enabled_source random_data * * @ProjectBrowserSource( * id = "random_data", diff --git a/modules/project_browser_source_example/src/Plugin/ProjectBrowserSource/ProjectBrowserSourceExample.php b/modules/project_browser_source_example/src/Plugin/ProjectBrowserSource/ProjectBrowserSourceExample.php index b3b02645c..9148c6126 100644 --- a/modules/project_browser_source_example/src/Plugin/ProjectBrowserSource/ProjectBrowserSourceExample.php +++ b/modules/project_browser_source_example/src/Plugin/ProjectBrowserSource/ProjectBrowserSourceExample.php @@ -25,8 +25,8 @@ class ProjectBrowserSourceExample extends ProjectBrowserSourceBase { // including them here for simplicity. // -- // Step 1: Interpret the $query made and adapt it to your needs so you can - // filter and sort the data accordingly. Refer to ProjectBrowserSourceInterface - // for information on which properties are available. + // filter and sort the data accordingly. + // @see \Drupal\project_browser\Plugin\ProjectBrowserSourceInterface $categories_filter = explode(',', $query['categories'] ?? ''); $machine_name_filter = $query['machine_name'] ?? ''; diff --git a/src/Commands/UpdateFixtureCommands.php b/src/Commands/UpdateFixtureCommands.php index 871a284bd..8b08e1d7c 100644 --- a/src/Commands/UpdateFixtureCommands.php +++ b/src/Commands/UpdateFixtureCommands.php @@ -2,8 +2,6 @@ namespace Drupal\project_browser\Commands; -// cspell:ignore commandfile - use Drupal\Core\Logger\LoggerChannelFactoryInterface; use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\project_browser\EnabledSourceHandler; @@ -13,6 +11,8 @@ use Drupal\project_browser\ProjectBrowserFixtureHelper; use Drush\Commands\DrushCommands; use Symfony\Component\EventDispatcher\EventDispatcherInterface; +// cspell:ignore commandfile + /** * A Drush commandfile. * @@ -62,7 +62,8 @@ class UpdateFixtureCommands extends DrushCommands { $this->loggerChannelFactory->get('project_browser')->info($this->t('Update fixture batch operations start')); $this->logger()->notice($this->t('Starting...')); - // Dispatch the event so that event listeners of other source can update their fixture. + // Dispatch the event so that event listeners of other source can update + // their fixture. $event = new UpdateFixtureEvent($this->enabledSource); $this->eventDispatcher->dispatch($event, ProjectBrowserEvents::UPDATE_FIXTURE); diff --git a/src/Controller/BrowserController.php b/src/Controller/BrowserController.php index 1cd4d869b..3a7572dd8 100644 --- a/src/Controller/BrowserController.php +++ b/src/Controller/BrowserController.php @@ -2,7 +2,6 @@ namespace Drupal\project_browser\Controller; -// cspell:ignore ctools use Drupal\Core\Controller\ControllerBase; use Drupal\Core\Extension\InfoParserException; use Drupal\Core\Extension\ModuleExtensionList; @@ -12,6 +11,8 @@ use Drupal\project_browser\Plugin\ProjectBrowserSourceBase; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\RequestStack; +// cspell:ignore ctools + /** * Defines a controller to provide the Project Browser UI. * diff --git a/src/Controller/InstallerController.php b/src/Controller/InstallerController.php index 2bdb4e2aa..915cb4c0b 100644 --- a/src/Controller/InstallerController.php +++ b/src/Controller/InstallerController.php @@ -119,10 +119,11 @@ class InstallerController extends ControllerBase { private function cancelRequire(): void { $this->resetProgress(); // Checking the for the presence of a lock in the package manager stage is - // necessary as this method can be called during create(), which includes both - // the PreCreate and PostCreate events. If an exception is caught during - // PreCreate, there's no stage to destroy and an exception would be raised. - // So, we check for the presence of a stage before calling destroy(). + // necessary as this method can be called during create(), which includes + // both the PreCreate and PostCreate events. If an exception is caught + // during PreCreate, there's no stage to destroy and an exception would be + // raised. So, we check for the presence of a stage before calling + // destroy(). if (!$this->installer->isAvailable() && $this->installer->lockCameFromProjectBrowserInstaller()) { // The risks of forcing a destroy with TRUE are understood, which is why // we first check if the lock originated from Project Browser. This @@ -350,8 +351,13 @@ class InstallerController extends ControllerBase { $minutes = $time_since_updated > 60 ? $minutes : 'less than 1'; if ($this->installer->isApplying()) { $message = empty(floor($hours)) ? - $this->t('The install staging area was locked @minutes minutes ago. It should not be unlocked as the changes from staging are being applied to the site.', ['@minutes' => $minutes]) : - $this->t('The install staging area was locked @hours hours, @minutes minutes ago. It should not be unlocked as the changes from staging are being applied to the site.', ['@hours' => $hours, '@minutes' => $minutes]); + $this->t('The install staging area was locked @minutes minutes ago. It should not be unlocked as the changes from staging are being applied to the site.', [ + '@minutes' => $minutes, + ]) : + $this->t('The install staging area was locked @hours hours, @minutes minutes ago. It should not be unlocked as the changes from staging are being applied to the site.', [ + '@hours' => $hours, + '@minutes' => $minutes, + ]); return $this->lockedResponse($message, ''); } @@ -361,7 +367,10 @@ class InstallerController extends ControllerBase { else { $message = empty($hours) ? $this->t('The install staging area was locked @minutes minutes ago.', ['@minutes' => $minutes]) : - $this->t('The install staging area was locked @hours hours, @minutes minutes ago.', ['@hours' => $hours, '@minutes' => $minutes]); + $this->t('The install staging area was locked @hours hours, @minutes minutes ago.', [ + '@hours' => $hours, + '@minutes' => $minutes, + ]); } $unlock_url = self::getUrlWithReplacedCsrfTokenPlaceholder( diff --git a/src/Controller/ProjectBrowserEndpointController.php b/src/Controller/ProjectBrowserEndpointController.php index e5b78ea78..d50036043 100644 --- a/src/Controller/ProjectBrowserEndpointController.php +++ b/src/Controller/ProjectBrowserEndpointController.php @@ -2,7 +2,6 @@ namespace Drupal\project_browser\Controller; -// cspell:ignore tabwise use Drupal\Component\Serialization\Json; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Controller\ControllerBase; @@ -12,6 +11,8 @@ use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +// cspell:ignore tabwise + /** * Controller for the proxy layer. */ diff --git a/src/Plugin/ProjectBrowserSource/MockDrupalDotOrg.php b/src/Plugin/ProjectBrowserSource/MockDrupalDotOrg.php index 6973dc5c4..8ae4c6c34 100644 --- a/src/Plugin/ProjectBrowserSource/MockDrupalDotOrg.php +++ b/src/Plugin/ProjectBrowserSource/MockDrupalDotOrg.php @@ -20,8 +20,10 @@ use Symfony\Component\DependencyInjection\ContainerInterface; /** * The source that mocks the Drupal.org API that's still to-be-built. * - * To enable this source (this is the default for the module): - * - `drush config:set --input-format=yaml project_browser.admin_settings enabled_sources '[drupalorg_mockapi]'` + * To enable this source use the following drush command. This source is the + * default for the Project Browser module. + * phpcs:ignore + * drush config:set --input-format=yaml project_browser.admin_settings enabled_sources '[drupalorg_mockapi]' * * @ProjectBrowserSource( * id = "drupalorg_mockapi", @@ -207,7 +209,7 @@ class MockDrupalDotOrg extends ProjectBrowserSourceBase implements ContainerFact } /** - * Convert the maintenance entry within the query from received to expected by DB. + * Converts the maintenance entry from received to expected by DB. * * @param array $query * Query array to transform. @@ -235,7 +237,7 @@ class MockDrupalDotOrg extends ProjectBrowserSourceBase implements ContainerFact } /** - * Convert the development entry within the query from received to expected by DB. + * Converts the development entry from received to expected by DB. * * @param array $query * Query array to transform. @@ -263,7 +265,7 @@ class MockDrupalDotOrg extends ProjectBrowserSourceBase implements ContainerFact } /** - * Convert the security entry within the query from received to expected by DB. + * Converts the security entry from received to expected by DB. * * @param array $query * Query array to transform. diff --git a/src/ProjectBrowserFixtureHelper.php b/src/ProjectBrowserFixtureHelper.php index e48c0b05a..1718c84dc 100644 --- a/src/ProjectBrowserFixtureHelper.php +++ b/src/ProjectBrowserFixtureHelper.php @@ -2,8 +2,6 @@ namespace Drupal\project_browser; -// cspell:ignore acquia - use GuzzleHttp\ClientInterface; use Composer\Semver\Semver; use Drupal\Component\Serialization\Json; @@ -14,6 +12,8 @@ use Drupal\Core\State\StateInterface; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\TransferStats; +// cspell:ignore acquia + /** * Provides methods to populate a local database from a fixture. */ @@ -453,9 +453,10 @@ class ProjectBrowserFixtureHelper { $project['body']['summary'] = Xss::filter(strip_tags($project['body']['summary'])); $project['body']['summary'] = Unicode::truncate($project['body']['summary'], 200, TRUE, TRUE); - // Once we hit projects that haven't been updated since March 13, 2020, we - // know they aren't compatible because it is before - // https://www.drupal.org/node/3119415. + // Projects that were last updated before 2020-03-13 are not + // compatible. That is date of the deprecation of the 'core' key from + // the info.yml file. + // @see https://www.drupal.org/node/3119415 if ($project['changed'] < 1583985600) { $earliest_possible_timestamp_reached = TRUE; } diff --git a/tests/modules/project_browser_test/src/Plugin/ProjectBrowserSource/DrupalDotOrgJsonApi.php b/tests/modules/project_browser_test/src/Plugin/ProjectBrowserSource/DrupalDotOrgJsonApi.php index 2674be743..661aaeef6 100644 --- a/tests/modules/project_browser_test/src/Plugin/ProjectBrowserSource/DrupalDotOrgJsonApi.php +++ b/tests/modules/project_browser_test/src/Plugin/ProjectBrowserSource/DrupalDotOrgJsonApi.php @@ -298,7 +298,8 @@ class DrupalDotOrgJsonApi extends ProjectBrowserSourceBase implements ContainerF $related = !empty($api_response['related']) ? $api_response['related'] : NULL; $current_drupal_version = $this->getNumericSemverVersion(\Drupal::VERSION); foreach ($api_response['list'] as $project) { - // Map any properties from jsonapi format to the expected format in Project. + // Map any properties from jsonapi format to the simplified record + // format used by Project Browser. $machine_name = $project['attributes']['field_project_machine_name']; $uid_info = $project['relationships']['uid']['data']; diff --git a/tests/src/Functional/InstallerControllerTest.php b/tests/src/Functional/InstallerControllerTest.php index c1d1c0054..e4fb99b63 100644 --- a/tests/src/Functional/InstallerControllerTest.php +++ b/tests/src/Functional/InstallerControllerTest.php @@ -2,8 +2,6 @@ namespace Drupal\Tests\project_browser\Functional; -// cspell:ignore crashmore - use Drupal\Component\Serialization\Json; use Drupal\package_manager\ValidationResult; use Drupal\package_manager_test_validation\EventSubscriber\TestSubscriber; @@ -17,6 +15,8 @@ use Drupal\project_browser_test\Datetime\TestTime; use Drupal\Tests\BrowserTestBase; use Drupal\Tests\project_browser\Traits\PackageManagerFixtureUtilityTrait; +// cspell:ignore crashmore + /** * Tests the installer controller. * diff --git a/tests/src/Functional/ProjectBrowserTest.php b/tests/src/Functional/ProjectBrowserTest.php index 5702f51c6..c5b9071e8 100644 --- a/tests/src/Functional/ProjectBrowserTest.php +++ b/tests/src/Functional/ProjectBrowserTest.php @@ -44,7 +44,7 @@ class ProjectBrowserTest extends BrowserTestBase { $assert->elementAttributeContains('css', 'div[aria-label="Status message"] ul li:nth-of-type(1) a', 'href', 'https://www.drupal.org/project/project_module'); $assert->pageTextContains('Your feedback and input are welcome at https://www.drupal.org/project/issues/project_browser'); $assert->elementAttributeContains('css', 'div[aria-label="Status message"] ul li:nth-of-type(2) a', 'href', 'https://www.drupal.org/project/issues/project_browser'); - // Enable another plugin to check that this message is not present in this case. + // Enable another plugin to check that this message is not present. $this->config('project_browser.admin_settings')->set('enabled_sources', ['drupal_core'])->save(TRUE); $this->getSession()->reload(); $assert->pageTextNotContains('Project Browser is currently a prototype, and the projects listed may not be up to date with Drupal.org. For the most updated list of projects, visit https://www.drupal.org/project/project_module'); diff --git a/tests/src/FunctionalJavascript/ProjectBrowserInstallerUiTest.php b/tests/src/FunctionalJavascript/ProjectBrowserInstallerUiTest.php index 5609a0e7c..375f80a23 100644 --- a/tests/src/FunctionalJavascript/ProjectBrowserInstallerUiTest.php +++ b/tests/src/FunctionalJavascript/ProjectBrowserInstallerUiTest.php @@ -156,7 +156,7 @@ class ProjectBrowserInstallerUiTest extends WebDriverTestBase { $this->assertTrue($assert_session->waitForText('An install staging area claimed by Project Browser exists but has expired. You may unlock the stage and try the install again.')); - // Click Unlock Install Stage link + // Click Unlock Install Stage link. $this->clickWithWait('#ui-id-1 > p > a'); $this->svelteInitHelper('text', 'Cream cheese on a bagel'); // Try beginning another install after breaking lock. @@ -189,7 +189,7 @@ class ProjectBrowserInstallerUiTest extends WebDriverTestBase { $cream_cheese_button = $page->find('css', "$cream_cheese_module_selector button"); $cream_cheese_button->click(); $this->assertTrue($assert_session->waitForText('The install staging area was locked less than 1 minutes ago. This is recent enough that a legitimate installation may be in progress. Consider waiting before unlocking the installation staging area.')); - // Click Unlock Install Stage link + // Click Unlock Install Stage link. $this->clickWithWait('#ui-id-1 > p > a'); $this->svelteInitHelper('text', 'Cream cheese on a bagel'); // Try beginning another install after breaking lock. diff --git a/tests/src/FunctionalJavascript/ProjectBrowserUiTest.php b/tests/src/FunctionalJavascript/ProjectBrowserUiTest.php index b6ed696b7..74a363b55 100644 --- a/tests/src/FunctionalJavascript/ProjectBrowserUiTest.php +++ b/tests/src/FunctionalJavascript/ProjectBrowserUiTest.php @@ -4,11 +4,12 @@ declare(strict_types=1); namespace Drupal\Tests\project_browser\FunctionalJavascript; -// cspell:ignore doomer eggman statusactive vetica quiznos statusmaintained coverageall - use Drupal\Core\Extension\MissingDependencyException; use Drupal\FunctionalJavascriptTests\WebDriverTestBase; +// cspell:ignore coverageall doomer eggman quiznos statusactive statusmaintained +// cspell:ignore vetica + /** * Provides tests for the Project Browser UI. * @@ -848,8 +849,9 @@ class ProjectBrowserUiTest extends WebDriverTestBase { $this->svelteInitHelper('css', '.filter__checkbox'); $assert_session->elementsCount('css', '.filter__checkbox', 20); - // Enable only Drupal.org mockapi plugin through config update. - // It is done this way because dragging was not working reliably for enabling Drupal.org mockapi plugin. + // Enable only Drupal.org mockapi plugin through config update. It is done + // this way because dragging was not working reliably for enabling + // Drupal.org mockapi plugin. $this->config('project_browser.admin_settings')->set('enabled_sources', ['drupalorg_mockapi'])->save(TRUE); $this->drupalGet('admin/config/development/project_browser'); $this->assertTrue($assert_session->optionExists('edit-enabled-sources-drupalorg-mockapi-status', 'enabled')->isSelected()); diff --git a/tests/src/FunctionalJavascript/ProjectBrowserUiTestJsonApi.php b/tests/src/FunctionalJavascript/ProjectBrowserUiTestJsonApi.php index 9216ec9bc..6103cee15 100644 --- a/tests/src/FunctionalJavascript/ProjectBrowserUiTestJsonApi.php +++ b/tests/src/FunctionalJavascript/ProjectBrowserUiTestJsonApi.php @@ -4,10 +4,12 @@ declare(strict_types=1); namespace Drupal\Tests\project_browser\FunctionalJavascript; -// cspell:ignore Blazy Cardless Colorbox Сontact ctools Fivestar Flipbook Fontawesome Iconpicker IMCE Micon Plupload Statusactive Statusmaintained Tagify Webform Zotero Zurb ZURB - use Drupal\FunctionalJavascriptTests\WebDriverTestBase; +// cspell:ignore Blazy Cardless Colorbox Сontact ctools Fivestar Flipbook +// cspell:ignore Fontawesome Iconpicker IMCE Micon Plupload Statusactive +// cspell:ignore Statusmaintained Tagify Webform Zotero Zurb ZURB + /** * ProjectBrowserUITest refactored to use the Drupal.org JSON API endpoint. * @@ -491,8 +493,9 @@ class ProjectBrowserUiTestJsonApi extends WebDriverTestBase { $this->svelteInitHelper('css', '.filter__categories input[type="checkbox"]'); $assert_session->elementsCount('css', '.filter__categories input[type="checkbox"]', 20); - // Enable only Drupal.org mockapi plugin through config update. - // It is done this way because dragging was not working reliably for enabling Drupal.org mockapi plugin. + // Enable only Drupal.org mockapi plugin through config update. It is done + // this way because dragging was not working reliably for enabling + // Drupal.org mockapi plugin. $this->config('project_browser.admin_settings')->set('enabled_sources', ['drupalorg_mockapi'])->save(TRUE); $this->drupalGet('admin/config/development/project_browser'); $this->assertTrue($assert_session->optionExists('edit-enabled-sources-drupalorg-mockapi-status', 'enabled')->isSelected()); diff --git a/tests/src/FunctionalJavascript/TranslatedSvelteAppTest.php b/tests/src/FunctionalJavascript/TranslatedSvelteAppTest.php index 2d1a116de..6420418ca 100644 --- a/tests/src/FunctionalJavascript/TranslatedSvelteAppTest.php +++ b/tests/src/FunctionalJavascript/TranslatedSvelteAppTest.php @@ -4,11 +4,11 @@ declare(strict_types=1); namespace Drupal\Tests\project_browser\FunctionalJavascript; -// cspell:ignore soorch foor moodools - use Drupal\Core\Language\LanguageInterface; use Drupal\FunctionalJavascriptTests\WebDriverTestBase; +// cspell:ignore soorch foor moodools + /** * Tests Svelte app translations. * diff --git a/tests/src/Unit/ProjectBrowserFixtureHelperTest.php b/tests/src/Unit/ProjectBrowserFixtureHelperTest.php index 7bc96a56a..677603676 100644 --- a/tests/src/Unit/ProjectBrowserFixtureHelperTest.php +++ b/tests/src/Unit/ProjectBrowserFixtureHelperTest.php @@ -2,8 +2,6 @@ namespace Drupal\Tests\project_browser\Unit; -// cspell:ignore elle - use Drupal\Core\Database\Connection; use Drupal\Core\Database\Query\Insert; use Drupal\Core\Database\Query\Truncate; @@ -13,6 +11,8 @@ use Drupal\Tests\UnitTestCase; use GuzzleHttp\ClientInterface; use org\bovigo\vfs\vfsStream; +// cspell:ignore elle + /** * @coversDefaultClass \Drupal\project_browser\ProjectBrowserFixtureHelper * @@ -103,7 +103,26 @@ EOS, 'flag_project_star_user_count' => '10', 'nid' => 0, 'status' => '1', - 'project_data' => ['body' => ['summary' => '<p>Text here for fake summary content.</p>'], 'field_project_images' => [], 'field_project_machine_name' => '1_starts_with_a_number', 'project_usage' => ['7.x-1.x' => 103, '8.x-2.x' => 10], 'taxonomy_vocabulary_3' => [], 'taxonomy_vocabulary_44' => ['uri' => 'https://www.drupal.org/api-d7/taxonomy_term/13028', 'id' => '13028', 'resource' => 'taxonomy_term'], 'taxonomy_vocabulary_46' => ['uri' => 'https://www.drupal.org/api-d7/taxonomy_term/9988', 'id' => '9988', 'resource' => 'taxonomy_term'], 'type' => 'project_module'], + 'project_data' => [ + 'body' => [ + 'summary' => '<p>Text here for fake summary content.</p>', + ], + 'field_project_images' => [], + 'field_project_machine_name' => '1_starts_with_a_number', + 'project_usage' => ['7.x-1.x' => 103, '8.x-2.x' => 10], + 'taxonomy_vocabulary_3' => [], + 'taxonomy_vocabulary_44' => [ + 'uri' => 'https://www.drupal.org/api-d7/taxonomy_term/13028', + 'id' => '13028', + 'resource' => 'taxonomy_term', + ], + 'taxonomy_vocabulary_46' => [ + 'uri' => 'https://www.drupal.org/api-d7/taxonomy_term/9988', + 'id' => '9988', + 'resource' => 'taxonomy_term', + ], + 'type' => 'project_module', + ], 'maintenance_status' => '13028', 'development_status' => '9988', 'field_project_machine_name' => '1_starts_with_a_number', -- GitLab