Closed (fixed)
Project:
Drupal.org security advisory coverage applications
Component:
module
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
8 Dec 2023 at 07:28 UTC
Updated:
3 Mar 2024 at 15:29 UTC
Jump to comment: Most recent
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
nikral commentedThanks @hemant-gupta for applying!
I have a few recommendations:
- /time_clock.libraries.yml
- core/jquery.once: you add core/jquery.once and- core/drupalSettingsas a dependencies but never use- /js/timezone.js
function ($, Drupal, once): You declare 'once' in the parameters but you don't use it (I think you can remove it)- /css/custom.css: This file is empty (you can delete it)
- /time_clock.module
time_clock_theme($existing, $theme, $type, $path): I think you can remove these unused params ($existing, $theme, $type, $path)- /time_clock.module hook_help()
function time_clock_help($route_name, RouteMatchInterface $route_match): You can remove $route_match if you don't use itComment #4
hemant-gupta commentedThanks for your review! @nikral
I have made changes accordingly in DEV, please see.
Comment #5
avpadernoI did not made a complete review, but I noticed the module implements a form class for the block settings. There is no need to implement a form class in that case. Block classes must implement the
BlockPluginInterfaceinterface which defines three methods for the block form:blockForm(),blockValidate(), andblockSubmit().Comment #6
hemant-gupta commentedI have used a block built only to make its data available to users and not implemented the form block as not needed, kindly recheck this.
Comment #7
avpadernoIf a form block is not necessary, there should not be any form class, since the existing form class is used only for the block settings.
Comment #8
hemant-gupta commentedOK, thanks for valuable info.
Comment #9
avpadernoComment #10
hemant-gupta commentedI have removed the form class and implemented "BlockPluginInterface" for the block settings now, please check.
Comment #11
simonbaeseSome comments - this is not a full review.
TimeClockBlockconstructor is incorrect.time-clock.html.twigis incorrect.Comment #12
hemant-gupta commentedThanks for your feedback!
Actually, this is a time centric module and if we use formats from 'admin/config/regional/date-time' then many date formats of them doesn't have a time to show and all these formats are freely managed in back-end on admin preference so I preferred like this way. Also, the block does not 'suffer' from caching to show us an updated content.
Suggested points have been corrected, let me know if still any thing found.
Comment #13
simonbaeseTested the block and the initial date and time do get cached. Therefore until the JavaScript is loaded the block will display cached values. When the user does not have JavaScript enabled (unlikely), the block will show wrong values. See this blog article on lazy builders which could be interesting in that context.
Comment #14
hemant-gupta commentedYes, I got your point and tried the same as they did in example but the module BigPipe does not support any more for the later version of Drupal 8 and that's why JS snippet covers this gap.
Comment #15
simonbaeseBigpipe is now part of Drupal core. Lazy building works without Bigpipe. Bigpipe just changes the delivery strategy of the content.
Comment #16
hemant-gupta commentedLazy builder added now. Let me know if further improvements needed.
Comment #17
vishal.kadamFILE: time_clock.info.yml
package: CustomThat line is used by custom modules created for specific sites. It is not a package name used for projects hosted on drupal.org.
Comment #18
hemant-gupta commentedIt's corrected, thanks!
Comment #19
andrei.vesterliHi @hemant-gupta
Thx for your contribution! Good job and keep it up! I will leave some comments after the review:
LICENSE.txtjs/timezone.js. It's not ok to declare functions inside theattach:of a Drupal behavior. Move them out of that behavior. Also, I am not sure about this statementtoday = today.toLocaleString("en-US", {timeZone:timezone, hour12:timeformat});speciallyen-UStemplates/time-clock.html.twig. There is a missing doc block. Check this guide and add the doxy to the twig file.src/Plugin/Block/TimeClockBlock.php. It's recommended to add the type of the property. Also, Are you sure
Constructs a new WorkspaceSwitcherBlock instance.?why not like this:
. Besides,
generateTimestamp. No declared params in the description, no return type, no params type, etc.tfunction:. I think there is no reason in that.
time_clock.module. A part of the$outputvariable from the hooktime_clock_helphas not()wrap. Check the line 18.Comment #20
andrei.vesterliComment #21
hemant-gupta commentedThanks for your feedback! @andrei.vesterli
All suggested points have been addressed accordingly.
Comment #22
avpadernoActually, the file containing the license should be present in every project repository. It was not necessary when CVS was used because, essentially, all the projects were hosted in a single repository which contained also Drupal core.
Comment #23
avpadernoComment #24
hemant-gupta commentedLicense file is added again! @apaderno
Comment #25
trigve hagen commentedGood code, a clear README, Coder returns a couple errors in the phpunit test, PARreview looks good. I didn't see any noticeable security vulnerabilities. Get these last things fixed so I can get you pushed to RTBC. Thanks
FILE: /var/www/html/global/web/modules/contrib/time_clock/src/Form/TimeClockForm.php
-----------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------
7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Config\ConfigFactoryInterface.
-----------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------
FILE: /var/www/html/global/web/modules/contrib/time_clock/src/Plugin/Block/TimeClockBlock.php
-----------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------
7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Config\ConfigFactoryInterface.
-----------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------
FILE: /var/www/html/global/web/modules/contrib/time_clock/js/timezone.js
---------------------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 2 LINES
---------------------------------------------------------------------------------------------
8 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
8 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
21 | ERROR | [x] Space before opening parenthesis of function call prohibited
21 | ERROR | [x] Expected 1 newline at end of file; 0 found
---------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------
Time: 2.93 secs; Memory: 10MB
Comment #26
trigve hagen commentedSince he is passing you to needs review if no one objects your good with me.
Comment #27
hemant-gupta commentedThanks for your review! @trigve-hagen
Also, your points are covered in DEV release.
Comment #28
hemant-gupta commentedComment #29
avpadernoThank you for your contribution!
I updated your account so you can now opt into security advisory coverage for any project you created and every project you will create.
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!
Thank you for your patience with the review process. 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 also the dedicated reviewers as well.
Comment #30
avpaderno