Commit 94ca9bc3 authored by xjm's avatar xjm
Browse files

Issue #2972224 by alexpott, longwave, jungle, sja112, xjm, dww, daffie,...

Issue #2972224 by alexpott, longwave, jungle, sja112, xjm, dww, daffie, kiamlaluno, dawehner, quietone, Lendude: Add .cspell.json to automate spellchecking in Drupal core
parent 29b2451c
{
"version": "0.1",
"language": "en-US",
"allowCompoundWords": false,
"ignorePaths": [
"assets/vendor/**",
"lib/Drupal/Component/Diff/**",
"lib/Drupal/Component/Transliteration/data/**",
"lib/Drupal/Core/File/MimeType/ExtensionMimeTypeGuesser.php",
"modules/**/Migrate*Test.php",
"modules/color/preview.html",
"modules/color/tests/modules/color_test/themes/color_test_theme/color/preview.html",
"modules/migrate_drupal/tests/fixtures/drupal6.php",
"modules/migrate_drupal/tests/fixtures/drupal7.php",
"modules/search/tests/UnicodeTest.txt",
"modules/system/tests/logo.svgz",
"node_modules/*",
"profiles/demo_umami/modules/demo_umami_content/default_content/languages/es/**/*",
"themes/bartik/color/preview.html",
"COPYRIGHT.txt",
"MAINTAINERS.txt",
"package.json",
"yarn.lock",
"misc/cspell/dictionary.txt"
],
"ignoreRegExpList": [
"^msgstr .*",
"!!binary .*",
"%[0-9][0-9A-F]"
],
"dictionaries": ["drupal","companies", "fonts", "html", "php", "softwareTerms"],
"dictionaryDefinitions": [
{ "name": "drupal", "path": "./misc/cspell/dictionary.txt"}
],
"flagWords": [
"hte"
],
"overrides": [
{
"filename": "**/{*.engine,*.inc,*.install,*.module,*.profile,*.theme}",
"languageId": "php"
},
{
"filename": "**/scripts/{*.php.txt, *.sh}",
"languageId": "php"
}
]
}
......@@ -192,6 +192,7 @@ public function object($size = 4) {
* Nonsense latin words which form sentence(s).
*/
public function sentences($min_word_count, $capitalize = FALSE) {
// cSpell:disable
$dictionary = ["abbas", "abdo", "abico", "abigo", "abluo", "accumsan",
"acsi", "ad", "adipiscing", "aliquam", "aliquip", "amet", "antehabeo",
"appellatio", "aptent", "at", "augue", "autem", "bene", "blandit",
......@@ -223,6 +224,7 @@ public function sentences($min_word_count, $capitalize = FALSE) {
"virtus", "voco", "volutpat", "vulpes", "vulputate", "wisi", "ymo",
"zelus",
];
// cSpell:enable
$dictionary_flipped = array_flip($dictionary);
$greeking = '';
......
......@@ -229,6 +229,7 @@ public static function getStandardLanguageList() {
// The "Left-to-right marker" comments and the enclosed UTF-8 markers are to
// make otherwise strange looking PHP syntax natural (to not be displayed in
// right to left). See https://www.drupal.org/node/128866#comment-528929.
// cSpell:disable
return [
'af' => ['Afrikaans', 'Afrikaans'],
'am' => ['Amharic', 'አማርኛ'],
......@@ -326,6 +327,7 @@ public static function getStandardLanguageList() {
'zh-hans' => ['Chinese, Simplified', '简体中文'],
'zh-hant' => ['Chinese, Traditional', '繁體中文'],
];
// cSpell:enable
}
/**
......@@ -340,6 +342,7 @@ public static function getStandardLanguageList() {
* names as values.
*/
public static function getUnitedNationsLanguageList() {
// cSpell:disable
return [
'ar' => ['Arabic', /* Left-to-right marker "" */ 'العربية', LanguageInterface::DIRECTION_RTL],
'zh-hans' => ['Chinese, Simplified', '简体中文'],
......@@ -348,6 +351,7 @@ public static function getUnitedNationsLanguageList() {
'ru' => ['Russian', 'Русский'],
'es' => ['Spanish', 'Español'],
];
// cSpell:enable
}
/**
......
......@@ -37,6 +37,7 @@ public function __construct(ModuleHandlerInterface $module_handler) {
* An array of country code => country name pairs.
*/
public static function getStandardList() {
// cSpell:disable
$countries = [
'AC' => t('Ascension Island'),
'AD' => t('Andorra'),
......@@ -297,6 +298,7 @@ public static function getStandardList() {
'ZM' => t('Zambia'),
'ZW' => t('Zimbabwe'),
];
// cSpell:enable
// Sort the list.
natcasesort($countries);
......
This diff is collapsed.
......@@ -819,6 +819,7 @@ public function testTemporaryUser() {
*/
public function testOverviewLinks() {
$this->drupalLogin($this->adminUser);
// cSpell:disable-next-line
$this->generateLogEntries(1, ['message' => "&lt;script&gt;alert('foo');&lt;/script&gt;<strong>Lorem</strong> ipsum dolor sit amet, consectetur adipiscing & elit."]);
$this->drupalGet('admin/reports/dblog');
$this->assertSession()->statusCodeEquals(200);
......
......@@ -115,6 +115,7 @@ public function testFileCreateUrl() {
// Characters that look like a percent-escaped string.
"%23%25%26%2B%2F%3F" .
// Characters from various non-ASCII alphabets.
// cSpell:disable-next-line
"éøïвβ中國書۞";
$basename_encoded = '%20-._~%21%24%27%22%28%29%2A%40%5B%5D%3F%26%2B%25%23%2C%3B%3D%3A__' .
'%2523%2525%2526%252B%252F%253F' .
......
......@@ -183,6 +183,7 @@ public function createUri($filepath = NULL, $contents = NULL, $scheme = NULL) {
if (!isset($filepath)) {
// Prefix with non-latin characters to ensure that all file-related
// tests work with international filenames.
// cSpell:disable-next-line
$filepath = 'Файл для тестирования ' . $this->randomMachineName();
}
if (!isset($scheme)) {
......
......@@ -37,6 +37,7 @@ public function testFileTokenReplacement() {
$test_file = $this->getTestFile('text');
// Coping a file to test uploads with non-latin filenames.
// cSpell:disable-next-line
$filename = \Drupal::service('file_system')->dirname($test_file->getFileUri()) . '/текстовый файл.txt';
$test_file = file_copy($test_file, $filename);
......
......@@ -196,6 +196,7 @@ public function createUri($filepath = NULL, $contents = NULL, $scheme = NULL) {
if (!isset($filepath)) {
// Prefix with non-latin characters to ensure that all file-related
// tests work with international filenames.
// cSpell:disable-next-line
$filepath = 'Файл для тестирования ' . $this->randomMachineName();
}
if (!isset($scheme)) {
......
......@@ -44,6 +44,7 @@ public function testWithFilename() {
$contents = $this->randomMachineName(8);
// Using filename with non-latin characters.
// cSpell:disable-next-line
$filename = 'Текстовый файл.txt';
$result = file_save_data($contents, 'public://' . $filename);
......
......@@ -323,6 +323,7 @@ public function testLineBreakFilter() {
// Since the line break filter naturally needs plenty of newlines in test
// strings and expectations, we're using "\n" instead of regular newlines
// here.
// cSpell:disable
$tests = [
// Single line breaks should be changed to <br /> tags, while paragraphs
// separated with double line breaks should be enclosed with <p></p> tags.
......@@ -381,6 +382,7 @@ public function testLineBreakFilter() {
'<p><drupal-media data-caption=" " data-entity-type="media" data-entity-uuid="dbb16f97-cd11-4357-acde-cd09e19e312b"></drupal-media></p>' => FALSE,
],
];
// cSpell:enable
$this->assertFilteredString($filter, $tests);
// Very long string hitting PCRE limits.
......@@ -1023,8 +1025,10 @@ public function testHtmlCorrectorFilter() {
$f = Html::normalize('<p>test\n</p>\n');
$this->assertEqual($f, '<p>test\n</p>\n', 'HTML corrector -- New-lines are accepted and kept as-is.');
// cSpell:disable
$f = Html::normalize('<p>دروبال');
$this->assertEqual($f, '<p>دروبال</p>', 'HTML corrector -- Encoding is correctly kept.');
// cSpell:enable
$f = Html::normalize('<script>alert("test")</script>');
$this->assertEqual($f, '<script>
......
......@@ -74,6 +74,7 @@ protected function canonicalizeUri($uri) {
// and &#x00FF; (except × &#x00D7; and ÷ &#x00F7;) with the addition of
// &#x0152;, &#x0153; and &#x0178;.
// @see https://git.drupalcode.org/project/link/blob/7.x-1.5-beta2/link.module#L1382
// cSpell:disable-next-line
$link_ichars = '¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿŒœŸ';
// Pattern specific to internal links.
......
......@@ -50,6 +50,7 @@ public function providerValidate() {
// Test allowed protocols.
$data[] = ['http://www.drupal.org', TRUE];
$data[] = ['https://www.drupal.org', TRUE];
// cSpell:disable-next-line
$data[] = ['magnet:?xt=urn:sha1:YNCKHTQCWBTRNJIV4WNAE52SJUQCZO5C', TRUE];
// Invalid protocols.
......
......@@ -74,6 +74,7 @@ public function testConfigTranslationImport() {
// Check if configuration translations have been imported.
$override = \Drupal::languageManager()->getLanguageConfigOverride('af', 'system.maintenance');
// cSpell:disable-next-line
$this->assertEqual($override->get('message'), 'Ons is tans besig met onderhoud op @site. Wees asseblief geduldig, ons sal binnekort weer terug wees.');
}
......
......@@ -291,11 +291,13 @@ public function testConfigPoFile() {
$config_strings = [
'system.maintenance' => [
'@site is currently under maintenance. We should be back shortly. Thank you for your patience.',
// cSpell:disable-next-line
'@site karbantartás alatt áll. Rövidesen visszatérünk. Köszönjük a türelmet.',
'message',
],
'user.role.anonymous' => [
'Anonymous user',
// cSpell:disable-next-line
'Névtelen felhasználó',
'label',
],
......
......@@ -56,6 +56,7 @@ protected function installParameters() {
*/
public function testInstallerTranslations() {
$this->drupalGet('user/login');
// cSpell:disable-next-line
$this->assertSession()->responseContains('Geben sie das Passwort für ihren Benutzernamen ein.');
}
......
......@@ -150,6 +150,7 @@ public function testUpdateImportSourceRemote() {
$this->assertEqual($history['contrib_module_three']['de']->last_checked, $this->timestampMedium, 'Translation of contrib_module_three is not updated');
// Check whether existing translations have (not) been overwritten.
// cSpell:disable
$this->assertEqual(t('January', [], ['langcode' => 'de']), 'Januar_1', 'Translation of January');
$this->assertEqual(t('February', [], ['langcode' => 'de']), 'Februar_2', 'Translation of February');
$this->assertEqual(t('March', [], ['langcode' => 'de']), 'Marz_2', 'Translation of March');
......@@ -157,6 +158,7 @@ public function testUpdateImportSourceRemote() {
$this->assertEqual(t('May', [], ['langcode' => 'de']), 'Mai_customized', 'Translation of May');
$this->assertEqual(t('June', [], ['langcode' => 'de']), 'Juni', 'Translation of June');
$this->assertEqual(t('Monday', [], ['langcode' => 'de']), 'Montag', 'Translation of Monday');
// cSpell:enable
}
/**
......@@ -204,6 +206,7 @@ public function testUpdateImportSourceLocal() {
$this->assertEqual($history['contrib_module_three']['de']->last_checked, $this->timestampMedium, 'Translation of contrib_module_three is not updated');
// Check whether existing translations have (not) been overwritten.
// cSpell:disable
$this->assertEqual(t('January', [], ['langcode' => 'de']), 'Januar_customized', 'Translation of January');
$this->assertEqual(t('February', [], ['langcode' => 'de']), 'Februar_2', 'Translation of February');
$this->assertEqual(t('March', [], ['langcode' => 'de']), 'Marz_2', 'Translation of March');
......@@ -211,6 +214,7 @@ public function testUpdateImportSourceLocal() {
$this->assertEqual(t('May', [], ['langcode' => 'de']), 'Mai_customized', 'Translation of May');
$this->assertEqual(t('June', [], ['langcode' => 'de']), 'Juni', 'Translation of June');
$this->assertEqual(t('Monday', [], ['langcode' => 'de']), 'Montag', 'Translation of Monday');
// cSpell:enable
}
/**
......@@ -240,6 +244,7 @@ public function testUpdateImportModeNonCustomized() {
$this->drupalPostForm('admin/reports/translations', [], t('Update translations'));
// Check whether existing translations have (not) been overwritten.
// cSpell:disable
$this->assertEqual(t('January', [], ['langcode' => 'de']), 'Januar_customized', 'Translation of January');
$this->assertEqual(t('February', [], ['langcode' => 'de']), 'Februar_customized', 'Translation of February');
$this->assertEqual(t('March', [], ['langcode' => 'de']), 'Marz_2', 'Translation of March');
......@@ -247,6 +252,7 @@ public function testUpdateImportModeNonCustomized() {
$this->assertEqual(t('May', [], ['langcode' => 'de']), 'Mai_customized', 'Translation of May');
$this->assertEqual(t('June', [], ['langcode' => 'de']), 'Juni', 'Translation of June');
$this->assertEqual(t('Monday', [], ['langcode' => 'de']), 'Montag', 'Translation of Monday');
// cSpell:enable
}
/**
......@@ -276,6 +282,7 @@ public function testUpdateImportModeNone() {
$this->drupalPostForm('admin/reports/translations', [], t('Update translations'));
// Check whether existing translations have (not) been overwritten.
// cSpell:disable
$this->assertTranslation('January', 'Januar_customized', 'de');
$this->assertTranslation('February', 'Februar_customized', 'de');
$this->assertTranslation('March', 'Marz', 'de');
......@@ -283,6 +290,7 @@ public function testUpdateImportModeNone() {
$this->assertTranslation('May', 'Mai_customized', 'de');
$this->assertTranslation('June', 'Juni', 'de');
$this->assertTranslation('Monday', 'Montag', 'de');
// cSpell:enable
}
/**
......@@ -304,6 +312,7 @@ public function testEnableUninstallModule() {
// Check if translations have been imported.
$this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.',
['%number' => 7, '%update' => 0, '%delete' => 0]), 'One translation file imported.');
// cSpell:disable-next-line
$this->assertTranslation('Tuesday', 'Dienstag', 'de');
$edit = [
......@@ -338,6 +347,7 @@ public function testEnableLanguage() {
// Check if there is no Dutch translation yet.
$this->assertTranslation('Extraday', '', 'nl');
// cSpell:disable-next-line
$this->assertTranslation('Tuesday', 'Dienstag', 'de');
// Add a language.
......@@ -349,6 +359,7 @@ public function testEnableLanguage() {
// Check if the right number of translations are added.
$this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.',
['%number' => 8, '%update' => 0, '%delete' => 0]), 'One language added.');
// cSpell:disable-next-line
$this->assertTranslation('Extraday', 'extra dag', 'nl');
// Check if the language data is added to the database.
......@@ -365,6 +376,7 @@ public function testEnableLanguage() {
// Check that the Dutch translation is gone.
$this->assertTranslation('Extraday', '', 'nl');
// cSpell:disable-next-line
$this->assertTranslation('Tuesday', 'Dienstag', 'de');
}
......
......@@ -134,6 +134,7 @@ public function testResolveCacheMissWithoutFallback() {
*/
public function testResolveCacheMissWithFallback($langcode, $string, $context, $expected) {
// These are fake words!
// cSpell:disable
$translations = [
'en' => [
'test' => 'test',
......@@ -153,6 +154,7 @@ public function testResolveCacheMissWithFallback($langcode, $string, $context, $
'missing pl' => 'chybějící pl',
],
];
// cSpell:enable
$this->storage->expects($this->any())
->method('findTranslation')
->will($this->returnCallback(function ($argument) use ($translations) {
......@@ -189,6 +191,7 @@ public function testResolveCacheMissWithFallback($langcode, $string, $context, $
* Provides test data for testResolveCacheMissWithFallback().
*/
public function resolveCacheMissWithFallbackProvider() {
// cSpell:disable
return [
['cs', 'test', 'irrelevant', 'test v české'],
['cs', 'fake', 'irrelevant', 'falešný'],
......@@ -203,6 +206,7 @@ public function resolveCacheMissWithFallbackProvider() {
['pl', 'missing cs', 'irrelevant', 'zaginiony czech'],
['pl', 'missing both', 'irrelevant', 'missing both'],
];
// cSpell:enable
}
/**
......
......@@ -667,6 +667,7 @@ public function testAlt() {
$assert_session->elementAttributeContains('named', ['field', 'attributes[alt]'], 'placeholder', 'default alt');
// Fill in the alt field, submit and return to CKEditor.
// cSpell:disable-next-line
$who_is_zartan = 'Zartan is the leader of the Dreadnoks.';
$page->fillField('attributes[alt]', $who_is_zartan);
$this->submitDialog();
......@@ -793,6 +794,7 @@ public function testTranslationAlt() {
$host->save();
$translation = $host->addTranslation('fr');
// cSpell:disable-next-line
$translation->title = 'Animaux avec des noms étranges';
$translation->body->value = $host->body->value;
$translation->body->format = $host->body->format;
......@@ -810,16 +812,20 @@ public function testTranslationAlt() {
$this->getSession()->switchToIFrame('ckeditor');
// Test that the default alt attribute displays without an override.
// cSpell:disable-next-line
$this->assertNotEmpty($assert_session->waitForElementVisible('xpath', '//img[contains(@alt, "texte alternatif par défaut")]'));
// Test `aria-label` attribute appears on the widget wrapper.
// cSpell:disable-next-line
$assert_session->elementExists('css', '.cke_widget_drupalmedia[aria-label="Tatou poilu hurlant"]');
$page->pressButton('Edit media');
$this->waitForMetadataDialog();
// Assert that the placeholder is set to the value of the media field's
// alt text.
// cSpell:disable-next-line
$assert_session->elementAttributeContains('named', ['field', 'attributes[alt]'], 'placeholder', 'texte alternatif par défaut');
// Fill in the alt field in the dialog.
// cSpell:disable-next-line
$qui_est_zartan = 'Zartan est le chef des Dreadnoks.';
$page->fillField('attributes[alt]', $qui_est_zartan);
$this->submitDialog();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment