Closed (fixed)
Project:
Drupal.org security advisory coverage applications
Component:
module
Priority:
Normal
Category:
Task
Assigned:
Issue tags:
Reporter:
Created:
22 Jul 2022 at 09:32 UTC
Updated:
1 Oct 2022 at 04:24 UTC
Jump to comment: Most recent
Comments
Comment #2
heni_deepak commentedComment #3
avpadernoThank you for applying! Reviewers will review the project files, describing what needs to be changed.
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 smother review.
To reviewers: Please read How to review security advisory coverage applications, What to cover in an application review, and Drupal.org security advisory coverage application workflow.
Since the project is being used for this application, for the time this application is open, only the user who created the application can commit code.
Comment #4
heni_deepak commented@apaderno
Thanks for updating properly. This is the first module I have applied for"
Drupal.org Security Advisor Coverage Application". Please review the code. I'm really excited.
Comment #5
avpadernoFunction names must be prefixed by the module machine name.
The code doesn't follow the Drupal coding standards. In particular, there aren't spaces where the coding standards expect them.
The verb in the description should use the third person singular. The documentation comment should describe the function parameters and the value returned from the function.
Since there are similar modules, the project page should make clear what the difference between this module and those modules is.
Comment #6
LuongGiap commentedHi @heni_deepak,
I run Drupal coding standard , You can review and fix.
Comment #7
heni_deepak commentedthanks, @apaderno, and @LuongGiap for your review of the improvement. I am working on it.
Comment #8
heni_deepak commentedComment #9
heni_deepak commented@apaderno
I have updated the validation function as per the Drupal coding standards.
I have updated the validation function coding for improvement.
Please advise me if any else needs to improve. also, I have open to your good suggestions.
@LuongGiap I have improved the point. can you please recheck it?
git clone --branch '2.0.x' https://git.drupalcode.org/project/block_id.gitComment #10
avpadernoThe documentation comment needs to describe the parameters and the return value (if the function returns a value).
A validation handler isn't expected to return values, not even Boolean values. In particular, returning
FALSEafter setting an error message doesn't skip the validation. The following code can be removed.There are still missing spaces, for example after
iforforeach, or before{. Verify also there aren't spaces before the end of a line.The placeholders for
t()are like@inputs_id, not@inputs_id@.FALSEreturned from a validation handler doesn't mean anything for Drupal. If the code expects to cause Drupal to skip the validation, the code is wrong. Does the code really need to avoid Drupal validates the values submitted from users? If the answer is yes, then the code needs to be changed. Otherwise, the code could be simply changed as follows.I used
@block_idto make clear to the translator users which ID is that.That comment isn't necessary, since the line following it is clear.
The submitted values are available with
$form_state->getValues(), which sanitizes the submitted values before returning them.Comment #11
heni_deepak commented@apaderno I have updated the code as per your instruction. I have learned a lot of things during this update, thanks.
Comment #12
radheymkumar commentedI have tested branch 2.0.x and it looks fine for me.
Comment #13
avpadernoThat line needs to be changed, since
core_version_requirement keyrequires Drupal 8.7.7, while semantic versioning requires Drupal 8.8.3. Drupal releases before Drupal 8.7.7 wouldn't install the module, since would not find any information about the required Drupal core release.That line is returning all the Block entities for which the third_party_settings property is an empty string, but the property contains an array. Would not loading all the Block entities and verifying none of the existing entities use the block ID set for the currently edited block be better?
Comment #14
heni_deepak commented$block_ids = \Drupal::entityQuery('block')->condition('third_party_settings', '')->execute();@apaderno I am tired to find a solution to add a confition-related third party after that I found this. But it's not working.
$block_ids = \Drupal::entityQuery('block')->condition('third_party_settings[block][id', '', '<>')->execute();Comment #15
avpadernoJust load the blocks without using any condition on the third_party_settings value, for example using
Drupal::entityTypeManager()->getStorage('block')->loadMultiple(), and then check the value returned by$block->getThirdPartySetting().Comment #16
heni_deepak commented@apaderno thank you. I have update my code as per you instruction.
Comment #17
heni_deepak commentedreview the code. I hope now it's everything fine.
Comment #18
avpadernoJust a side note before I do a full review: a validation handler doesn't need to return anything. Instead of
return FALSE;you can usereturn;.Comment #19
heni_deepak commentedI have replaced the code.
https://git.drupalcode.org/project/block_id/-/commit/2763c5ec232e1a1b9bf...
Comment #20
avpadernoThe module dependencies should be namespaced; instead of
block, it should bedrupal:block, since the Block module is part of Drupal core.Comment #21
avpadernoThank you for your contribution! I am going to update your account.
These are some recommended readings to help with excellent maintainership:
You can find more contributors chatting on the Slack #contribute channel. So, come hang out and stay involved.
Thank you, also, 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 all the reviewers too.
Comment #22
heni_deepak commented@apaderno Thank you so much. I have changed dependency as per your comment.