Follow-up to #1392754: Comply with new documentation standards for @file for namespaced class files, some parts of the @file docblock cleanup during rc have been addressed in #2598840: Bad @file description in Test files classes & #2600304: Bad @file description in core/ classes
Problem/Motivation
In the @file docblock, some descriptions are malformed due to incorrect namespaces or class names. For example :
/**
* @file
* Contains \Drupal\Core\Command\DbDumpCommand.
*/
namespace Drupal\Core\Command;
...
class DbImportCommandThe class is DbImportCommand in this case, not DbDumpCommand
OR
/**
* @file
* Contains \Drupal\system\Tests\PhpStorage\PhpStorageFactoryTest.
*/
namespace Drupal\Tests\system\Kernel\PhpStorage;
...
class PhpStorageFactoryTest extends KernelTestBase {The namespace in the definition is Drupal\system\Tests\PhpStorage where the declared namespace is Drupal\Tests\system\Kernel\PhpStorage;
Proposed resolution
- Resolve incorrect namespaces or class names in the @file docblock definitions
I don't think there is a simple grep to find these, will attempt to repurpose an old bash script from the original issue.
First attempt a script to find these, feel free to improve: https://gist.github.com/justAChris/acb1479407b7c0e5d1aa
This should be RC Eligible since this only cleans up documentation only
| Comment | File | Size | Author |
|---|---|---|---|
| #19 | interdiff-2600538-6-7.txt | 440 bytes | rakesh.gectcr |
| #19 | 2600538-7.patch | 17.74 KB | rakesh.gectcr |
| #15 | interdiff-2600538-4-6.txt | 541 bytes | rakesh.gectcr |
| #15 | interdiff-2600538-5-6.txt | 419 bytes | rakesh.gectcr |
| #15 | 2600538-6.patch | 17.14 KB | rakesh.gectcr |
Comments
Comment #2
justachris commentedScript to parse files to find incorrect namespace or classname in the @file docblock:
https://gist.github.com/justAChris/acb1479407b7c0e5d1aa
Produces the attached list of files. Ignoring
core/lib/Drupal/Component/Assertion/Handle.php, since the script incorrectly gets the classname andcore/lib/Drupal/Core/Archiver/ArchiveTar.phpbecause that file is a bit of a mess (missing docblock, etc..)Comment #3
anil280988 commentedCreated Patch
Comment #5
anil280988 commentedRe-created the patch
Comment #6
jhodgdonThanks! Most of this looks fine. But there are a few problems:
In this case, I do not think that the standard @file header for PSR-4 classes is appropriate.
Let's just take this out of the patch. This file deserves a better @file block. It should contain the stuff that is currently in the test class docs I think.
In any case, the standard of making @file this way is only really meant for standard PSR-4 class files.
Huh, what??? This one doesn't seem right...
This namespace line change seems to be out of scope for the issue. Also it doesn't look correct to me. Remove from the patch.
Out of scope for this issue. Also incorrect as far as I can tell. The namespace doesn't have Compiler in there twice. Remove from the patch.
Comment #7
rakesh.gectcr@jhodgdon
I have done the changes you mentioned.
@anil280988
Be careful while you changing the name space, It can effect entire system too.
Comment #8
rakesh.gectcrComment #10
jhodgdonThanks, but:
Do not change namespaces in this patch!
If you think they are wrong (and this one looks wrong), please file a separate issue. This issue is in the "documentation" component and should only change documentation lines.
Comment #11
rakesh.gectcr@jhodgdon
Sorry it was mistake from my side, i did the changes you addressed. I could have been checked patch. Any way I changed that.
about the namespace i will do the home work , Then its necessary i will create the new issue.
Please find the patch and interdiff files
Comment #12
rakesh.gectcrComment #14
jhodgdonThanks! But now:
The change here does not agree with the namespace line below. Let's leave this file alone and file a separate issue to fix the docs and namespace together. Put that into the "ban module" component.
Thanks!
Comment #15
rakesh.gectcr@jhodgdon
I have done the changes you mentioned above
I have created a separate issue to fix the docs and namespace together, the issue link is following
https://www.drupal.org/node/2601780
Thank You!
Comment #16
jhodgdonGreat, thanks!
Comment #17
jhodgdonWhoops. I went over to #2601780: Wrong name space and @file description in /core/modules/ban/ and investigated more closely.
It looks like core/modules/ban/tests/src/Unit/Plugin/migrate/source/d7/BlockedIpsTest.php:
- Does actually have the correct namespace line
- Does not have the right Contains line at the top, because the class name is BlockedIpsTest not BlockedIps.
So can we add the change from BlockedIps to BlockedIpsTest at the end of this line, to this patch?
Comment #19
rakesh.gectcr@jhodgdon
I applied the changes you have mentioned.
Thank you!
Comment #20
rakesh.gectcrComment #22
jhodgdonThanks!
Comment #23
alexpottCommitted 0a8d97e and pushed to 8.0.x. Thanks!