- Issue created by @iheb.attia
- 🇮🇹Italy apaderno Brescia, 🇮🇹
Thank 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.
- If you have not done it yet, enable GitLab CI for the project, and fix what reported from the phpcs job. This help to fix most of what reviewers would report.
- For the time this application is open, only your commits are allowed. No other people, including other maintainers/co-maintainers can make commits.
- The purpose of this application is giving you a new drupal.org role that allows you to opt projects into security advisory coverage, either projects you already created, or projects you will create. The project status won't be changed by this application.
- Nobody else will get the permission to opt projects into security advisory policy. If there are other maintainers/co-maintainers who will to get that permission, they need to apply with a different module.
- We only accept an application per user. If you change your mind about the project to use for this application, or it is necessary to use a different project for the application, please update the issue summary with the link to the correct project and the issue title with the project name and the branch to review.
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.
- It is preferable to wait for a Code Review Administrator before commenting on newly created applications. Code Review Administrators will do some preliminary checks that are necessary before any change on the project files is suggested.
- Reviewers should show the output of a CLI tool → only once per application. The configuration used for these tools needs to be the same configuration used by GitLab CI, stored in the GitLab Templates repository.
- It may be best to have the applicant fix things before further review.
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 → .
- 🇮🇹Italy apaderno Brescia, 🇮🇹
I do not have time for a complete review, but the following code needs to be changed.
/** * DynamicReferenceSelectionUtil constructor. * * @param \Symfony\Component\DependencyInjection\ContainerInterface $container * The container service. */ public function __construct(ContainerInterface $container) { $this->container = $container; $this->entityFieldManager = $container->get('entity_field.manager'); $this->fieldTypePluginManager = $container->get('plugin.manager.field.field_type'); $this->request = $container->get('request_stack') ->getCurrentRequest(); }
Services define their dependencies in the .services.yml file, and those are directly passed to the class constructor.
- 🇮🇳India vishal.kadam Mumbai
1. FILE: src/Ajax/UpdateOptionsCommand.php
/** * UpdateOptionsCommand constructor. * * @param string $elementId * The element html id. * @param array $options * The element options [key, value]. * @param string $formatter * The field formatter. * @param bool $multiple * The 'multiple' attribute of select. */ public function __construct(
FILE: src/Util/DynamicReferenceSelectionUtil.php
/** * DynamicReferenceSelectionUtil constructor. * * @param \Symfony\Component\DependencyInjection\ContainerInterface $container * The container service. */ public function __construct(ContainerInterface $container) {
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.
2. FILE: dynamic_reference_selection.module
/** * @file * Dynamic Reference Selection module. */
The usual description for a .module file is “Hook implementations for the [module name] module”, where [module name] is the module name given in the .info.yml file.
- 🇫🇷France iheb.attia
Thank you avpaderno → and vishal.kadam → for reviewing the module. I've addressed the previous issues in this commit.
Please let me know if there's anything else that needs to be fixed, or if you can proceed with approving my request for Security Advisory coverage. - 🇮🇹Italy apaderno Brescia, 🇮🇹
It appears there are multiple project applications created using your account.
Since a successful completion of the project application process results in the applicant being granted the necessary role to be able to opt projects into security advisory coverage, there is no need to take multiple applications through the process. Once the first application has been successfully approved, the applicant can promote other projects without review. Because of this, posting multiple applications is not necessary, and results in additional workload for reviewers, which in turn results in longer wait times for everyone in the queue. With this in mind, your secondary applications have been marked as Closed (duplicate), with only one application left open.If you prefer that we proceed through this review process with a different application, then feel free to close the application left open as a duplicate, and re-open one of the project applications which had been closed.
- 🇮🇹Italy apaderno Brescia, 🇮🇹
Let's continue with this application, since it uses a project with enough Drupal code.
- 🇮🇹Italy apaderno Brescia, 🇮🇹
- The following points are just a start and don't necessarily encompass all of the changes that may be necessary
- A specific point may just be an example and may apply in other places
- A review is about code that does not follow the coding standards, contains possible security issue, or does not correctly use the Drupal API
- The single review points are not ordered, not even by importance
src/Plugin/EntityReferenceSelection/DynamicReferenceSelectionViewsSelection.php
/** * Constructs a new SelectionBase object. *
That short description is for a different class.
Why does not
DynamicReferenceSelectionViewsSelection.php
extendSelectionBase
?src/Util/DynamicReferenceSelectionUtil.php
if (($field_storage instanceof FieldConfig || ($field_storage instanceof BaseFieldDefinition && $field_name == 'title')) ) {
The curly parenthesis needs to be on the same line containing
if
, as per Drupal coding standards. - 🇫🇷France iheb.attia
Hello avpaderno → ,
Thank you very much for your detailed review and the time you spent on it.
The requested changes have been addressed in this commit.
Could you please take another look so that the module can move forward and become eligible for Drupal security advisory coverage? - 🇷🇴Romania bbu23
Hi, here're some quick thoughts from my end:
Optional observations:
- There is no dev release for this project. While not mandatory to have one, I’d recommend it.
- The __construct() method’s description is not mandatory anymore, it can either be removed or be kept as is if preferred.Feedback:
- For a new module that aims to be compatible with Drupal 10 and Drupal 11, I would rather implement:
- hooks as class methods as described in Support for object oriented hook implementations using autowired services → .
- plugins as PHP Attributes instead of PHP Annotations as described in Attribute-based plugins →
- There seem to be some properties defined in the Annotation class that might not be used. Is it on purpose or am I mistaken?
- In thedynamic_reference_selection.module
file, it’s probably not a good idea to usestdClass
. Furthermore, it’s not even used, so the line becomes redundant.
- Same file, line 23: the variable comment should be in one line
- Same file,$items = $context['items'];
is initialised twice, once when even not checking if context is set. This piece of code could be improved.
- Line 44,$parent_field = NULLl;
not used
-src/Plugin/EntityReferenceSelection/DynamicReferenceSelectionViewsSelection.php
: The messenger service is passed as argument increate
method, but never received in the constructor. Is it used?
- Same file, as described in theweb/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php
file, it is better to use the Trait’st()
function when possible. I see no reason for using the TranslatableMarkup here, u should change to t().The above observations serve as examples, I didn't have time to go through everything.
On the other hand, the coding standards and best practices successfully validated with PHPCS.