LanguageWire Translation Provider is a Drupal module that uses TMGMT module (https://www.drupal.org/project/tmgmt) to offer the option of new provider (LanguageWire) and this way gives the user the option to use LanguageWire translation services, to provide more effective and professional translations.
Project link
https://www.drupal.org/project/languagewire_translation_provider
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | languagewire_translation_provider-PHPCS-report.txt | 1.62 MB | vishal.kadam |
Issue fork projectapplications-3398888
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
Comment #2
vishal.kadamThank you for applying!
Please read Review process for security advisory coverage: What to expect for more details and Security advisory coverage application checklist to understand what reviewers look for. Tips for ensuring a smooth review gives some hints for a smoother review.
The important notes are the following.
phpcs --standard=Drupal,DrupalPracticeon the project, which alone fixes most of what reviewers would report.To the reviewers
Please read How to review security advisory coverage applications, Application workflow, What to cover in an application review, and Tools to use for reviews.
The important notes are the following.
For new reviewers, I would also suggest to first read In which way the issue queue for coverage applications is different from other project queues.
Comment #3
vishal.kadammainis a wrong branch name, as branch names end with the literal .x. That branch needs to be removed.Comment #4
avpadernoDrupal core is going to switch to main as main branch. main is an acceptable branch name, but drupal.org is still not completely able to handle that branch name and it is preferable to still use a branch name like 1.x or 2.0.x as described in Release branches.
Comment #5
avpadernoComment #6
lucm_lw commentedComment #7
avpadernoComment #8
avpadernoThere is still a single branch, main, which needs to be deleted. Before that, a new branch must be created and the code committed on that branch. See Release branches for more details about the correct branch names to use.
Comment #9
avpadernoFurthermore, the project page does not describe the module, its requirements, nor its features; it does not even give information useful to decide whenever the module is a good suit for somebody's purpose.
Comment #10
lucm_lw commentedComment #11
lucm_lw commentedComment #12
vishal.kadamComment #13
vishal.kadamFix PHPCS issues
See attached phpcs report.
It seems you have missed working on the coding standards. You can use the PHPCS tool for checking and resolving issues.
Comment #14
avpadernoComment #15
avpadernoMore importantly, the license for projects hosted on drupal.org cannot be MIT, as the project page says. Providing a project under that license is contrary to the Git access agreement you accepted.
Comment #16
lucm_lw commentedWe already change the License from MIT to GPL 2.0.
About the code on library that is not complying with coding standards of Drupal, this is because this is a API communication that will be change to a newer one, very soon. If the changes are needed we can do it, so please let me known.
Comment #17
avpadernoLibraries that are available from other sites or repositories must not be committed in drupal.org repositories. If those libraries are necessary for the module to work, the project page should give instructions on how to install the library.
Furthermore, if that library has a license that is different from the one used by Drupal core, it cannot be committed in drupal.org repositories, for the same reason I gave in comment #15.
Comment #18
lucm_lw commentedChanged all the code and libraries to comply with Drupal standards.
Please review now please.
Thanks
Comment #19
avpadernoSee my previous comment. The library code must be removed from the module repository.
Comment #20
lucm_lw commentedAlready fix this library misunderstood, since this is part of this module.
Thanks
Comment #21
phthlaap commentedBranch 10.x-1.x
1. file composer.json
"LanguageWire\\": "api/src/"In the project structure, the 'api/src' folder seems to be missing. Can you check again?
2. Still have Coding Standard issues reported by PHPCS
Comment #22
phthlaap commentedComment #23
avpadernoTruly, as Drupal module, the only namespaces it can define start with
\Drupal\languagewire_translation_provider\. The directory associated to those namespaces must be the src directory in the module repository.Comment #24
lucm_lw commentedGood afternoon,
Already fixed all the possible cases for the code standards and also change the namespace to comply with the one provided.
Thanks.
Comment #25
avpadernoAll the files/directories contained in the api directory must be moved in the src directory.
The following documentation comment added to all those files must be removed, since those files are not part of the LanguageWire PHP Client Library package, as comment #20 said they are part of the module.
@category,@package, and@copyrightare not used in drupal.org repositories. The last one would not probably hold true, as in GPL-2.0-or-later code, the copyright is hold between all the users who contributed code with commits.src/Adapter/Content/DrupalVariablePlaceholderPrefixingConvention.php
As per Object-oriented code (part of Drupal coding standards), class names should not include Drupal.
src/Adapter/Database/DrupalConfigurationItemRepository.php
The documentation comment for constructors is not mandatory anymore, If it is given, the description must be Constructs a new [class name] object. where [class name] includes the class namespace.
The short description for a method must not repeat the method name, but be more descriptive about its purpose. It should also be longer than one or two words. The documentation comment must describe the method parameters and the return value, if the method returns any value. If then the method is inherited from a parent class or defined in an interface, the documentation comment can simply be
{@inheritdoc}.@throwsmust also say when the exception is thrown.src/Adapter/Database/LanguageWireConfigurationItemRepositoryInterface.php
The short description for a method must not repeat the method name, but be more descriptive about its purpose. The documentation comment must describe the method parameters and the return value, if the method returns any value.
src/Adapter/Entity/DrupalEntityRepository.php
That is not the correct description for a property containing an object that implements
\Psr\Log\LoggerInterface.The first argument passed to the logger methods that log a message must be a literal string, not translatable strings nor string concatenations.
src/Adapter/DrupalSystem.php
In a service class, the parameters passed to the class constructor are the ones defined for the service, in the .services.yml file.
In a service class, all the dependencies are injected using Dependency Injection, not using
Drupal::service().Comment #26
lucm_lw commentedHi there,
I have performed all the changes above and removed the "__construct" document comments, since they are not mandatory (as said).
phpcs is now throwing that removal as an error, but I assume that should be fine.
Wait for more feedbacks.
Thanks.
Best regards
Comment #27
lucm_lw commentedHi,
Happy new year to all of you.
Do we have any news about the reviews? Any progress on that?
Thanks.
Best regards
Comment #28
lucm_lw commentedHi there,
Would really appreciate any feedback whenever possible, since this becomes a important release to make.
Really grateful for all the feedback that as been given.
Best regards
Comment #29
avpadernoThose files are part of the languagewire_translation_provider module, not the LanguageWire PHP Client Library package. Those comments must be removed.
Furthermore, the project title (and module names) are different from the project machine name.
Comment #30
lucm_lw commentedAs requested comments sections was changed and correct.
Wait for more feedback.
Thanks.
Best regards
Comment #31
rushikesh raval commentedI am changing the issue priority as per issue priorities.
Comment #32
solideogloria commentedPlease update the module page to have more readable formatting. Use headings and subheadings, and make the module title a readable name, rather than the "machine name" containing underscores. Look at Coder as an example.
Also, in the future, please consider using semantic versioning for branch names and releases.
I'm not able to view or clone the project repository for some reason right now, as it says "Deploy in progress"...
Comment #33
solideogloria commentedYour README.md does not follow best practices.
INSTALL.md contains outdated instructions. Remove info about Drupal 7. Also, when viewing the file, the images don't load.
The files in
./config/optionalhave CRLF line terminators. These should be changed to Unix-style LF line terminators.languagewire_translation_provider.info.yml: All dependencies must be prefixed with the project name. Also, remove version and timestamp info. Those will be added automatically. See a good example in the Webform module.
There are multiple classes that use
\Drupalcalls. Use dependency injection instead, if possible.The .module and .install files aren't even close to following Drupal coding standards. Sort your
usestatements alphabetically, have functions' opening braces on the same line as the function declaration. Include function comments for every function. TRUE, FALSE and NULL must be uppercase. Functions not in a class/trait/enum should be snake_case and prefixed with the module name.Many of the issues can be automatically found by PHPCS and fixed by PHPCBF if you run those. Please run them, because there are many more issues that I have not listed, as there are too many. You should also configure your IDE to integrate with PHPCS, so that it will highlight coding standards violations as you type. If you use Visual Studio Code, you can use PHP Sniffer & Beautifier.
Comment #34
lucm_lw commentedComment #35
avpadernoComment #36
lucm_lw commentedComment #37
lucm_lw commentedAs suggested I applied the recommendations above.
Also as said before, I removed the "__construct" document comments, since they are not mandatory (as said).
phpcs is now throwing that removal as an error, but I assume that should be fine.
The multiple classes that use \Drupal calls were already replaced to use dependency injection, when it was possible.
Wait for more feedbacks
Comment #38
lucm_lw commentedComment #39
avpadernoThere is no need to create new branches because of this application.
Changing branch to review make it harder for reviewers to understand what has been changed and verify the changes are exactly what the review asked for.
Comment #40
avpadernoComment #41
avpadernosrc/Adapter/System.php
src/Adapter/TMGMT/TmgmtTranslatorRepository.php
src/Ui/CheckoutUi.php
Classes used for services must not call any
\Drupalmethod. Instead, they need to inject their dependencies.src/Adapter/Logger/NineLogger.php
This class is merely returning a Drupal service. Remove this class and use directly that Drupal service.
Furthermore, if the code changes basing on the Drupal version, you need to have two different branches.
languagewire_translation_provider.services.yml
Those services are not autowired. Their definitions are missing the service arguments.
A class without dependencies does not need to implement a service.
src/Ui/JobInfoUi.php
src/Ui/ConfigurationFormUi.php
src/Ui/CheckoutUi.php
src/Ui/CheckoutUi/TemplateOrServiceForm.php
Those classes build a form, but no submission button is added. See what that means in Form generation.
Those forms do not have validation handlers. Adding a method whose name starts with validate does not automatically make it a form validation handler.
Form classes are also not used for services.
src/Service/HtmlPreviewService.php
The first argument of warning() and similar logger methods, must be a literal string, not a concatenation of strings, nor a translatable string.
src/Content/HtmlPreview/HtmlPreviewSettingsChecker.php
Why isn't the code using the file_system service?
If those errors are shown in the user interface to users, they must be translatable.
src/api
All the classes contained in that directory and its sub-directories do not have any dependency on Drupal core. They need to be hosted outside of drupal.org.
In general, check also the code formatting, which must follow the Drupal coding standards. The Drupal coding standards, among other things, do not say the indentation is four spaces or more.
Check also the documentation comments which, as reported in a previous comment, should not repeat the class/method name; they should not also repeat what already said in the documentation comment used in the parent class or interfaces the class implements.
I would also check the code with
phpcs --standard=Drupal,DrupalPractice, as already suggested, because it still reports warnings and errors.It feels like the module is implementing own classes when it should use classes Drupal already provides.
I did check only the classes that are referenced in the .services.yml file. I will check the other ones too, once I find a way to get the list of the classes effectively instantiated from services or the module file.
Comment #42
lucm_lw commentedHi there,
I already made the possible changes required above.
Some \Drupal calls can't be class injected, so it was already replace where it was possible.
Wait for more feedback on this.
Thanks.
Comment #43
vishal.kadamI am changing priority as per Issue priorities.
Comment #44
avpadernoThank you for your contribution and for your patience with the review process!
I am going to update your account so you can opt into security advisory coverage any project you create, including the projects you already created.
These are some recommended readings to help you with maintainership:
You can find more contributors chatting on Slack or IRC in #drupal-contribute. So, come hang out and stay involved!
Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
I thank the dedicated reviewers as well.
Comment #45
avpadernoComment #46
avpadernoComment #47
lucm_lw commented