Drupal Core has some pretty atrocious spelling errors in it.

Now, on one hand, we're geeks. Why would spelling matter?

However, as part of reaching a global audience, misspelled English words are a real affront to folks whose first language isn't English.

Finding text through search/replace is also more of a challenge when not all of the words are consistently used.

It also just looks pretty amateur. If this is an enterprise system, we can't be filled with lots of stupid typos in the code.

This is an issue to look specifically at the PHP errors.

Patch from #2329703-64: [meta] Spellchecking Drupal

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Status: Needs review » Needs work

The last submitted patch, drupal8-spellchecked-modules_code-2329703-64.patch, failed testing.

mgifford’s picture

Status: Needs work » Needs review
FileSize
41.58 KB

CHOSING was corrected in another patch, so the correction in core/modules/block/block.module isn't needed:

"Once a block has been placed, it can also be moved to a different region by choosing a region from the Region dropdown menu on the Block layout page, or by dragging and dropping it to the right position."

jhodgdon’s picture

Following on comments by @alexpott in the parent issue...

It seems to me that spelling errors in test modules and test classes are very minor problems.

On the other hand, spelling errors that are displayed in Drupal sites are real problems.

So can we perhaps separate this out into two issues/patches: spelling errors in test code and spelling errors that are outside of tests? We can prioritize the "outside of tests" part while leaving the "in tests" part until a less disruptive time in the beta cycle.

mgifford’s picture

Issue tags: +Needs re-roll

Sure, this sub-issue can be broken down into more sub-issues. Certainly, errors that are displayed are worse. If someone does this I'm happy to review it. These changes have already had a lot of review though. I'd like it to be RTBC now.

Status: Needs review » Needs work

The last submitted patch, 2: drupal8-spellchecked-modules_code-2383871-2.patch, failed testing.

rpayanm’s picture

Status: Needs work » Needs review
Issue tags: -Needs re-roll
FileSize
40.8 KB
mgifford’s picture

Status: Needs review » Reviewed & tested by the community

This patch is getting smaller all the time. I think it's ready now though.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 7: 2383871-7.patch, failed testing.

Status: Needs work » Needs review

mgifford queued 7: 2383871-7.patch for re-testing.

rpayanm’s picture

Status: Needs review » Reviewed & tested by the community

again.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 7: 2383871-7.patch, failed testing.

rpayanm’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
40.79 KB

and again.

jhodgdon’s picture

Status: Reviewed & tested by the community » Needs work

I read through this whole patch again. I'm a bit concerned by:

--- a/core/modules/toolbar/css/toolbar.module.css
+++ b/core/modules/toolbar/css/toolbar.module.css
@@ -134,7 +134,7 @@ body.toolbar-tray-open.toolbar-fixed.toolbar-vertical .toolbar-oriented {
   display: none;
   z-index: 501;
 }
-.toolar .toolbar-tray > .toolbar-lining {
+.toolbar .toolbar-tray > .toolbar-lining {
   position: relative;
 }

Why is this in the PHP patch and has someone tested this CSS change? Presumably this CSS has never worked, and if it wasn't needed it should probably just be removed, not spellchecked into now suddenly doing something.

This part is also a bit scary:

+++ b/core/modules/update/tests/modules/update_test/src/MockFileTransfer.php
@@ -27,7 +27,7 @@ public static function factory() {
    */
   public function getSettingsForm() {
     $form = array();
-    $form['udpate_test_username'] = array(
+    $form['update_test_username'] = array(
       '#type' => 'textfield',
       '#title' => t('Update Test Username'),
     );

This is changing a form element ID and I cannot believe it was working correctly both without and with this patch. Either this piece of settings form is never accessed in a test or ... something else is wrong.

mgifford’s picture

Status: Needs work » Needs review
FileSize
40.28 KB

I removed the CSS fragment. Agreed this isn't in the right place.

There is only one instance of 'udpate_test_username', so I have to assume it never worked and also that there is no code leveraging this test at the moment. Maybe I'm wrong though.

Still, I don't see how fixing this will cause a problem.

mgifford queued 15: 383871-15.patch for re-testing.

mgifford’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll, +Spelling mistake

The last submitted patch, 15: 383871-15.patch, failed testing.

rpayanm’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
38.34 KB
maximpodorov’s picture

Status: Needs review » Reviewed & tested by the community

Looks correct. Most changes are test messages (and test method names) now, and the rest are trivial changes. Anyway, after applying the last patch, new iteration of spell checking can be performed to find the new and missing typos.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 19: 2383871-19.patch, failed testing.

maximpodorov’s picture

Status: Needs work » Needs review
FileSize
36.1 KB

The patch is re-rolled.

a_thakur’s picture

FileSize
446 bytes

overridden was misspelled in core/modules/simpletest/src/TestBase.php, fixed it in the new patch.

interdiff attached as well.

a_thakur’s picture

FileSize
36.63 KB
a_thakur’s picture

Status: Needs review » Needs work

The last submitted patch, 24: 2383871-23.patch, failed testing.

Status: Needs work » Needs review

a_thakur queued 24: 2383871-23.patch for re-testing.

mgifford’s picture

FileSize
35.96 KB

The spelling error in core/modules/config/src/Tests/ConfigDependencyTest.php was corrected. Here's a re-roll for the rest.

Status: Needs review » Needs work

The last submitted patch, 28: 2383871-28.patch, failed testing.

AohRveTPV’s picture

Status: Needs work » Needs review

Initially I don't see why the patch would cause that fail.

AohRveTPV queued 28: 2383871-28.patch for re-testing.

AohRveTPV’s picture

Are grammatical errors within the scope of this patch? If so, in the patched code: "invalidate" -> "invalid"

AohRveTPV’s picture

Status: Needs review » Reviewed & tested by the community

OK to set this to RTBC?

  • xjm committed ac3b766 on 8.0.x
    Issue #2383871 by mgifford, rpayanm, a_thakur, maximpodorov, AohRveTPV,...
xjm’s picture

Component: documentation » other
Priority: Normal » Minor
Status: Reviewed & tested by the community » Fixed

Thanks all for your work on this!

Just a not that I disagree with "atrocious" spelling errors -- none of these are user-facing, and most of them are only in test code. So for the most part this is a minor issue. It also requires very careful review to ensure that none of the changes are introducing regressions, and I'd prefer not to be doing this during this phase of the release cycle, even though it's technically mostly unfrozen. However, the patch is ready, and I've reviewed it carefully, so I decided to go ahead with it since this has a higher chance of disruption during RC or a patch release than other cleanups of this nature. And, after all, the spelling errors are irritating and a bit embarrassing. :)

Going forward, though, let's always do a beta evaluation and consider what the impact vs. the disruption of a minor change is, and whether it's worth the resources during the beta. (For reference, it took me 20 minutes to review this and make sure it wasn't breaking anything.)

A few notes from my review follow:

  1. +++ b/core/modules/ckeditor/tests/modules/src/Plugin/CKEditorPlugin/LlamaButton.php
    @@ -26,7 +26,7 @@ class LlamaButton extends Llama implements CKEditorPluginButtonsInterface {
    -        'label' => t('Insert Lllama'),
    +        'label' => t('Insert Llama'),
    

    But if "llama" with two Ls is cool, isn't three Ls even cooler? ;)

  2. +++ b/core/modules/node/src/Entity/NodeType.php
    @@ -143,8 +143,8 @@ public function displaySubmitted() {
    -  public function setDisplaySubmitted($display_submtited) {
    -    $this->display_submitted = $display_submtited;
    +  public function setDisplaySubmitted($display_submitted) {
    +    $this->display_submitted = $display_submitted;
    
    +++ b/core/modules/node/src/NodeTypeInterface.php
    @@ -52,7 +52,7 @@ public function displaySubmitted();
    -  public function setDisplaySubmitted($display_submtited);
    +  public function setDisplaySubmitted($display_submitted);
    

    Fixing spelling errors in variable names is a prioritized change (though small impact here). I grepped to confirm there were no other instances of display_submtited. This is the one change in this patch that is indeed prioritized for the beta, I think.

  3. +++ b/core/modules/quickedit/src/Form/QuickEditFieldForm.php
    @@ -143,7 +143,7 @@ protected function init(FormStateInterface $form_state, EntityInterface $entity,
    -    foreach ($display->getComponents() as $name => $optipns) {
    +    foreach ($display->getComponents() as $name => $options) {
    

    It raised a red flag for me that I only see this variable changed where it's defined, but $options isn't actually used. Only $name is. It might be better as array_keys($display->getComponents() -- but that would be out of scope. So this change is okay.

  4. +++ b/core/modules/simpletest/src/AssertContentTrait.php
    @@ -645,13 +645,13 @@ protected function assertUniqueTextHelper($text, $message = '', $group = 'Other'
    -    $first_occurance = strpos($this->getTextContent(), $text);
    -    if ($first_occurance === FALSE) {
    +    $first_occurrence = strpos($this->getTextContent(), $text);
    +    if ($first_occurrence === FALSE) {
           return $this->assert(FALSE, $message, $group);
         }
    -    $offset = $first_occurance + strlen($text);
    -    $second_occurance = strpos($this->getTextContent(), $text, $offset);
    -    return $this->assert($be_unique == ($second_occurance === FALSE), $message, $group);
    +    $offset = $first_occurrence + strlen($text);
    +    $second_occurrence = strpos($this->getTextContent(), $text, $offset);
    +    return $this->assert($be_unique == ($second_occurrence === FALSE), $message, $group);
    

    Another misspelled variable name. I confirmed there are no other instances of first_ nor second_occurance.

  5. +++ b/core/modules/system/src/Form/PerformanceForm.php
    @@ -61,11 +61,11 @@ class PerformanceForm extends ConfigFormBase {
    -  public function __construct(ConfigFactoryInterface $config_factory, CacheBackendInterface $render_cache, DateFormatter $date_formater, AssetCollectionOptimizerInterface $css_collection_optimizer, AssetCollectionOptimizerInterface $js_collection_optimizer) {
    +  public function __construct(ConfigFactoryInterface $config_factory, CacheBackendInterface $render_cache, DateFormatter $date_formatter, AssetCollectionOptimizerInterface $css_collection_optimizer, AssetCollectionOptimizerInterface $js_collection_optimizer) {
         parent::__construct($config_factory);
     
         $this->renderCache = $render_cache;
    -    $this->dateFormatter = $date_formater;
    +    $this->dateFormatter = $date_formatter;
         $this->cssCollectionOptimizer = $css_collection_optimizer;
    

    Another misspelled variable. I grepped to confirm there are no other instances of date_formater.

  6. +++ b/core/modules/system/src/Tests/Module/InstallUninstallTest.php
    @@ -101,7 +101,7 @@ public function testInstallUninstall() {
    -      $this->assertSuccessfullUninstall($name, $package);
    +      $this->assertSuccessfulUninstall($name, $package);
    
    @@ -116,7 +116,7 @@ public function testInstallUninstall() {
    -          $this->assertSuccessfullUninstall($name, $package);
    +          $this->assertSuccessfulUninstall($name, $package);
    
    @@ -151,7 +151,7 @@ public function testInstallUninstall() {
    -  protected function assertSuccessfullUninstall($module, $package = 'Core') {
    +  protected function assertSuccessfulUninstall($module, $package = 'Core') {
    

    Misspelled method name used only within this test. I confirmed there are no other assertSuccessfullUninstall.

  7. Most of the changes in the patch are to test method names and assertion messages. The assertion messages have no impact, but the test method names could if the classes were overridden in extending tests (a pattern that we use in a few rare cases). I confirmed that none of these were that.

Committed and pushed to 8.0.x. Thanks everyone for your attention to detail with this issue. :)

maximpodorov’s picture

Halleluiah! Let's go back to 7.x in #2329703: [meta] Spellchecking Drupal!

Pere Orga’s picture

mgifford’s picture

That's great @xjm - glad to see this is fixed. Your Lllama comment made me think of the "I'm a llama, you're a llama song" with the hand gestures.

With #35.3 where the variable is defined "but $options isn't actually used." have you opened up a new issue for that or would you like me to do that.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.