- Issue created by @osab
- ๐ฎ๐ณIndia vishal.kadam Mumbai
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, you should run
phpcs --standard=Drupal,DrupalPractice
on the project, which alone fixes most of what reviewers would report. - For the time this application is open, only your commits are allowed.
- 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 and no other user will be able to opt projects into security advisory policy.
- 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.
- 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 โ .
- If you have not done it yet, you should run
- Status changed to Needs work
9 months ago 2:49pm 13 March 2024 - ๐ฎ๐นItaly apaderno Brescia, ๐ฎ๐น
I didn't have time to check all the project files, but there is a change that is necessary.
Projects hosted on drupal.org are licensed under the same license used from Drupal core: GPLv2+. Any other license, including GPLv3, are not allowed.
- ๐ฎ๐ณIndia vishal.kadam Mumbai
Fix phpcs issues.
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml cache_review/ FILE: cache_review/src/Render/RenderCacheReview.php --------------------------------------------------------------------------------------------- FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES --------------------------------------------------------------------------------------------- 75 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead 78 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead --------------------------------------------------------------------------------------------- FILE: cache_review/src/Controller/CacheReviewController.php ----------------------------------------------------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE ----------------------------------------------------------------------------------------------------------------- 7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Cache\Cache. ----------------------------------------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY ----------------------------------------------------------------------------------------------------------------- FILE: cache_review/css/cache_review.css ------------------------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE ------------------------------------------------------------------------------------- 27 | ERROR | [x] Expected 1 space before opening brace of class definition; 0 found ------------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY ------------------------------------------------------------------------------------- FILE: cache_review/README.txt ---------------------------------------------------------------------- FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES ---------------------------------------------------------------------- 18 | WARNING | Line exceeds 80 characters; contains 88 characters 54 | WARNING | Line exceeds 80 characters; contains 83 characters 57 | WARNING | Line exceeds 80 characters; contains 83 characters ----------------------------------------------------------------------
- ๐บ๐ฆUkraine osab Germany, Baden-Wรผrttemberg; Ukraine, Kharkiv
Thank you @apaderno and @vishal.kadam for help!
I've removed Lisence file and add phpcs fixes (looks like I have some options and resctrictions in phpcs CLI command before )) ).As for cache_review/src/Render/RenderCacheReview.php I need your advices how it can be made better.
The point is I wanted to make my module work on Drupal 10 and Drupal 11. That's why I can't set 'cache_factory' (for Drupal 10) or 'variation_cache_factory' (Drupal 11) as arguments in servise file directly.
So, I've found the same approach in core/lib/Drupal/Core/Render/PlaceholderingRenderCache.php:public function __construct(RequestStack $request_stack, $cache_factory, CacheContextsManager $cache_contexts_manager, PlaceholderGeneratorInterface $placeholder_generator) { if ($cache_factory instanceof CacheFactoryInterface) { @trigger_error('Injecting ' . __CLASS__ . ' with the "cache_factory" service is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use "variation_cache_factory" instead. See https://www.drupal.org/node/3365546', E_USER_DEPRECATED); $cache_factory = \Drupal::service('variation_cache_factory'); } parent::__construct($request_stack, $cache_factory, $cache_contexts_manager); $this->placeholderGenerator = $placeholder_generator; }
Maybe it will be Ok to implements ContainerFactoryPluginInterface and add this condition in create() method, but I'm not sure that is correct approach.
Thanks in advance! - Status changed to Needs review
9 months ago 10:34am 21 March 2024 - ๐ฎ๐นItaly apaderno Brescia, ๐ฎ๐น
You cannot have code that works with Drupal 10.0 and Drupal 11, when Drupal 11 implements a different service Drupal 10.0 does not have.
The following code will not work on Drupal 10.0, since it would request a service that does not exist in Drupal 10.
if ($cache_factory instanceof CacheFactoryInterface) { @trigger_error('Injecting ' . __CLASS__ . ' with the "cache_factory" service is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use "variation_cache_factory" instead. See https://www.drupal.org/node/3365546', E_USER_DEPRECATED); $cache_factory = \Drupal::service('variation_cache_factory'); }
If the module requires Drupal 10.1 or higher version, it would work, since the variation_cache_factory service would be defined.
- ๐บ๐ฆUkraine osab Germany, Baden-Wรผrttemberg; Ukraine, Kharkiv
Thank you, @apaderno! So, if I understood correctly, the better way is to remove version_compare in code, like
version_compare(\Drupal::VERSION, '10.2', '<')
, add 'variation_cache_factory' service only and restrict module to core version 10.1 and higher? - ๐ฎ๐นItaly apaderno Brescia, ๐ฎ๐น
That's correct.
The alternative would make a branch for Drupal 10.0, and one for Drupal 10.1 and Drupal 11. I would follow this path only in the case you are writing the module for a site you know cannot use Drupal 10.1 or Drupal 11, though.
- Status changed to Active
9 months ago 9:58pm 30 March 2024 - ๐บ๐ฆUkraine osab Germany, Baden-Wรผrttemberg; Ukraine, Kharkiv
updated.
- Set >10.1 version and variation_cache_factory only.
Please, review whenever you will have time. Thanks a lot! - Status changed to Needs review
9 months ago 10:44pm 30 March 2024 - ๐บ๐ฆUkraine osab Germany, Baden-Wรผrttemberg; Ukraine, Kharkiv
hi @apaderno! Could you help once more and review the module after my changes? Thank you in advance!
- ๐ซ๐ทFrance andypost
Variation cache API added in 10.2 https://www.drupal.org/node/3365546 โ
so it needs changes to
^10.2
https://git.drupalcode.org/project/cache_review/-/commit/c6374867771ce83... - Status changed to Needs work
8 months ago 5:28pm 7 May 2024 - ๐บ๐ฆUkraine osab Germany, Baden-Wรผrttemberg; Ukraine, Kharkiv
Thank you, @andypost!
Here is fix for 1.1.x
https://git.drupalcode.org/project/cache_review/-/commit/94dfc4eef0a9085...I also updated 1.0.x
https://git.drupalcode.org/project/cache_review/-/commit/e09bc2cc9d0c58b... - Status changed to Needs review
8 months ago 1:01pm 8 May 2024 - ๐ซ๐ทFrance andypost
Thank you, makes sense to add some test and setup CI
- Status changed to Needs work
7 months ago 6:44pm 11 May 2024 - ๐บ๐ฆUkraine osab Germany, Baden-Wรผrttemberg; Ukraine, Kharkiv
fixing https://www.drupal.org/project/cache_review/issues/3446118 ๐ Add basic test and setup CI Needs work is in progress...
- ๐บ๐ฆUkraine osab Germany, Baden-Wรผrttemberg; Ukraine, Kharkiv
added basic test and CI setup. Please review.
- Status changed to Needs review
5 months ago 1:33pm 28 July 2024 - Status changed to Needs work
4 months ago 10:02am 6 September 2024 - ๐ฎ๐นItaly apaderno Brescia, ๐ฎ๐น
- The following points are just a start and don't necessarily encompass all 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 issues, or does not correctly use the Drupal API; the single points are not ordered, not even by importance
src/Controller/CacheReviewController.php
Since that class is not using any of the methods implemented from the parent class (
ControllerBase
), it does not need to use it as parent class. Controllers do not need a parent class; as long as they implement\Drupal\Core\DependencyInjection\ContainerInjectionInterface
, they are fine.$build['intro'] = [ '#markup' => '<i>After loading or cache clearing, this page should be MISS and after next loading becomes HIT (it depends on your auto_placeholder_conditions, look at Page Cache Status). The functionality was tested with auto_placeholder_conditions: {"max-age":0,"contexts":["session","user"],"tags":[]}.<br>Try to change cache options in cache_review\Controller\CacheReviewController::cachedMaxAge and see result.<br>Pay attention to time indicators - the section from cache will have obsolete time. Try to reload page after several seconds and updating one of section due to max-age will lead to rebuild cache whole page because of bubbling cache properties.<br>On the other page we have an example with lazy wrapper to restrict changing data inside separate section only.</i><br>', ];
Messages shown in the user interface must be translatable.
- ๐ฎ๐ณIndia rushiraval
I am changing priority as per Issue priorities โ .
- ๐บ๐ฆUkraine osab Germany, Baden-Wรผrttemberg; Ukraine, Kharkiv
@avpaderno Thank you! I've added fixes in issue https://www.drupal.org/project/cache_review/issues/3494073#comment-15902344 ๐ CacheReviewController refactoring and adding UI translations Active . After review I can merge them to 1.1x branch.
Unfortunately, I have practically no time left to work on the module, so I will be glad for any help if cache?review is really useful for the community. - ๐ฎ๐ณIndia vishal.kadam Mumbai
@osab These applications do not require you to create new issues in your project after reviews. Simply push the changes addressing the review comments to the review branch i.e. 1.1.x.
- ๐ฎ๐ณIndia vishal.kadam Mumbai
FILE: cache_review.module
/** * Implements hook_preprocess_HOOK(). */ function cache_review_preprocess_html(&$variables) {
The description for this hook should also say for which theme hook it is implemented.
/** * @file * Contains cache_review.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.