Problem/Motivation

This issue is to coordinate all the steps in order to remove all other uses of "illegal" that were not addressed on Re-word "An illegal choice has been detected" message to remove legality suggestion.
Currently there are 40+ lines of code using the word "illegal", which includes comments, function names, schemas, constraints.

Proposed resolution

Change uses of 'illegal' to 'invalid'
Add 'illegal' to cspell flag word to prevent further instances creeping in.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
Screenshot 2023-02-11 at 00.02.54.png964.57 KBschlaukopf

Issue fork drupal-3340978

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

schlaukopf created an issue. See original summary.

xjm’s picture

Issue summary: View changes

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone made their first commit to this issue’s fork.

quietone’s picture

Title: [meta] Remove other uses of “illegal” from core » Remove uses of “illegal” from core
Version: 11.x-dev » main
Issue summary: View changes
Status: Active » Needs review

I simply changed 'illegal' to 'invalid', which is the simplest thing to do here. I also added 'illegal' to prevent future usages of the word, I don't see the code base dealing with legality.

ghost of drupal past’s picture

Fun historical tidbit: Dries raised the illegal vs invalid wording problem twenty years ago but it got lost in the noise trying to make the option checker work which was quite the fight. While I remember the fight which lasted until 2010 I didn't remember this piece until I searched the original issue for invalid to see whether anyone raised it: #39179-10: Make optgroups work with choice checker.

dcam’s picture

I left a few comments on the MR. I tried to review the text changes for grammar and accuracy.

quietone’s picture

@dcam, thanks for review. I have applied the fixes you suggested.

dcam’s picture

Status: Needs review » Reviewed & tested by the community

Thank you for considering my feedback. This looks good to me now.

ghost of drupal past’s picture

Do we have any idea what this means?

Not sure about y'all but I do. You kind of found it out too but let me finish your comment: when I originally wrote aggregate support the methods existsAggregate and notExistsAggregate were just called exists and notExists the same methods as on QueryInterface -- this was a mistake on my end -- which led to this mysterious comment on them. This is visible in the first patch attached. Also in that patch sortAggregate didn't have any documentation. Then as the issue proceeded the requirement to have some documentation on everything even if it makes no sense have bitten you in that someone else I don't want to blame because the policy is to blame just copy-pasted these comments with minor adjustments. And then in #1854708-27: EntityQuery aggregation support the current method names were introduced and the original comments were removed but the copy-paste remained. The chain of disaster is now complete.

Documentation bloat delenda est: the project needs remove the requirement to document everything, add a requirement to document when it's needed, change documentation standards to emphasize the documentation focus is on helping developers so reviewers can point to it so that on commit there's documentation where it's needed but not more. Add a footnote to every change record stating when people upgrade their code and find the documentation inadequate they should be filing issues especially if they managed to figure it out because that's usually the best moment to document something.

dww’s picture

Category: Plan » Task

Yes, please! +100.

Since we're actually changing the strings with an MR in this issue, this is more of a task than a plan.

On main, a recursive, case-insensitive grep for 'illegal' gives me 54 hits.

On the MR branch, we're down to these 7:

./core/.cspell.json:      "illegal",
./core/modules/migrate_drupal/tests/fixtures/drupal6.php:  'source' => '%name: illegal value.',
./core/modules/migrate_drupal/tests/fixtures/drupal6.php:  'source' => 'Illegal value for %name.',
./core/modules/migrate_drupal/tests/fixtures/drupal6.php:  'source' => 'The specified form name contains one or more illegal characters. Spaces or any other special characters except dash (-) and underscore (_) are not allowed.',
./core/assets/vendor/once/once.js: * Illegal spaces in ids.
./core/assets/vendor/htmx/htmx.js:          // Wrap in function with apply to correctly bind the FormData context, as a direct call would result in an illegal invocation error
./core/assets/vendor/htmx/htmx.js:          // Wrap in function with apply to correctly bind the FormData context, as a direct call would result in an illegal invocation error
  • .cspell.json is to add it as a flag word.
  • We don't want to touch migrate fixtures.
  • We don't have direct control over vendor hits in core/assets, and those are all just comments, nothing user-facing.

Nothing else to improve. Ship it. Thanks!

dcam’s picture

There was a merge conflict in core/modules/user/src/Plugin/Validation/Constraint/UserNameConstraint.php. I rebased the MR.

dww’s picture

Re-reviewed recent commits. Still RTBC to my eyes.

Thanks!
-Derek

longwave’s picture

Version: main » 11.x-dev
Status: Reviewed & tested by the community » Fixed

This can only go into a minor release as it contains a handful of user-facing string changes.

Committed and pushed 5d2be21b9ee to main and a3c0a51ba23 to 11.x. Thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • longwave committed a3c0a51b on 11.x
    task: #3340978 Remove uses of “illegal” from core
    
    By: schlaukopf
    By:...

  • longwave committed 5d2be21b on main
    task: #3340978 Remove uses of “illegal” from core
    
    By: schlaukopf
    By:...

Status: Fixed » Closed (fixed)

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